Emulsion composition sensor

ABSTRACT

A system for sensing an estimated composition of a produced fluid being conducted from a reservoir includes: at least one device for measuring temperature data; at least one device for obtaining flow rate data, pressure data, pump speed data and valve travel data; a first produced fluid density generator; a second produced fluid density generator; and a composition generator. The first produced fluid density generator is configured to generate a first produced fluid density based on the obtained flow rate, pressure, pump speed and valve travel data. The second produced fluid density generator is configured to generate a second produced fluid density based at least in part on the measured temperature data. The composition generator is configured to: iteratively generate a phantom component content, a bitumen content and a water content for the produced fluid based on at least in part on: a material balance of the produced fluid.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present disclosure claims all benefit, including priority, of U.S.Provisional Patent Application 62/247,815, filed Oct. 29, 2015, andentitled “EMULSION COMPOSITION SENSOR”, the entirety of which, includingappendices, is hereby incorporated by reference.

FIELD

The present disclosure generally relates to the field of hydrocarbonrecovery and in particular to systems, devices and methods forestimating emulsion composition in a hydrocarbon recovery process.

INTRODUCTION

Emulsion streams in hydrocarbon recover processes can consist ofdifferent components including bitumen, water, gases, and solids.Samples of the emulsion streams can be taken for laboratory analysis todetermine the composition of the emulsion stream at the time ofsampling. However, the laboratory analysis can take days to complete.

It would be beneficial to estimate the composition of an emulsion streammore quickly.

SUMMARY

In accordance with one aspect, there is provided a system for sensing anestimated composition of a produced fluid being conducted from areservoir. The system includes at least one device for measuringtemperature data for the produced fluid; at least one device forobtaining flow rate data, pressure data, pump speed data and valvetravel data for the produced fluid being conducted from the reservoir;at least one memory device for storing obtained and historical data; afirst produced fluid density generator; a second produced fluid densitygenerator; and a composition generator. The first produced fluid densitygenerator is configured to generate a first produced fluid density basedat least in part on the obtained flow rate data, pressure data, pumpspeed data and valve travel data for the produced fluid being conductedfrom the reservoir. The second produced fluid density generator isconfigured to generate a second produced fluid density based at least inpart on a bitumen reference density corresponding to the measuredtemperature data, a water reference density corresponding to themeasured temperature data, and a phantom component reference densitycorresponding to the measured temperature data. The compositiongenerator is configured to: generate, with an iterative convergencetool, a phantom component content, a bitumen content and a water contentfor the produced fluid based on at least in part on: a material balanceof the produced fluid and a difference between the first produced fluiddensity and the second produced fluid density; and generate outputsrepresenting the phantom component content, the bitumen content and thewater content.

In accordance with another aspect, there is provided a method forsensing an estimated composition of a produced fluid being conductedfrom a reservoir. The method includes: measuring, with at least onesensing device, temperature data for the produced fluid; obtaining, withthe at least one sensing device, flow rate data, pressure data, pumpspeed data and valve travel data for the produced fluid being conductedfrom the reservoir; generating a first produced fluid density based atleast in part on the obtained flow rate data, pressure data, pump speeddata and valve travel data for the produced fluid being conducted fromthe reservoir; generating a second produced fluid density based at leastin part on a bitumen reference density corresponding to the measuredtemperature data, a water reference density corresponding to themeasured temperature data, and a phantom component reference densitycorresponding to the measured temperature data; generating, with aniterative convergence tool, a phantom component content, a bitumencontent and a water content for the produced fluid based on at least inpart on: a material balance of the produced fluid and a differencebetween the first produced fluid density and the second produced fluiddensity; and generating outputs representing the phantom componentcontent, the bitumen content and the water content.

In accordance with another aspect, there is provided a non-transitory,computer-readable medium or media having stored thereon instructionswhich when executed by at least one processor configure the at least oneprocessor for: measuring, with at least one sensing device, temperaturedata for the produced fluid; obtaining, with the at least one sensingdevice, flow rate data, pressure data, pump speed data and valve traveldata for the produced fluid being conducted from the reservoir;generating a first produced fluid density based at least in part on theobtained flow rate data, pressure data, pump speed data and valve traveldata for the produced fluid being conducted from the reservoir;generating a second produced fluid density based at least in part on abitumen reference density corresponding to the measured temperaturedata, a water reference density corresponding to the measuredtemperature data, and a phantom component reference densitycorresponding to the measured temperature data; generating, with aniterative convergence tool, a phantom component content, a bitumencontent and a water content for the produced fluid based on at least inpart on: a material balance of the produced fluid and a differencebetween the first produced fluid density and the second produced fluiddensity; and generating outputs representing the phantom componentcontent, the bitumen content and the water content.

DESCRIPTION OF THE FIGURES

FIG. 1A is a cross sectional view of an example geological formation andSAGD well;

FIG. 1B is a top view of a geological area illustrating SAGD wells andinfrastructure for an example project;

FIG. 2 is an example system to which aspects of the present disclosuremay be applied; and

FIG. 3 is a flowchart illustrating aspects of an example method forsensing an estimated emulsion composition.

FIG. 4 is a flowchart illustrating aspects of an example method forsensing an estimated emulsion composition.

FIG. 5 is a flowchart illustrating aspects of an example method forsensing an estimated emulsion composition.

FIG. 6 is an example line graph showing bitumen density vs. temperature.

FIG. 7 is an example line graph showing Western Canadian Select crudeoil density vs. temperature.

FIG. 8 shows example line graphs of bitumen viscosity vs. temperature.

FIG. 9 is an example line graph showing Western Canadian Select crudeoil viscosity vs. temperature.

FIG. 10 shows line graphs of an example logistic curve and a choke valveflow characteristic curve.

FIG. 11 is a nomograph outlining the impact of viscosity on valve flowcoefficient correction factor.

FIG. 12 is a flowchart illustrating aspects of an example neural networkfor generating produced fluid density.

FIG. 13 is a flowchart illustrating aspects of an example neural networkfor generating produced fluid viscosity.

FIG. 14 is a flowchart illustrating aspects of an example neural networkfor generating produced fluid composition.

FIG. 15 is a cross section of a wellhead pipe when an emulsion is at itsreference state.

FIG. 16 is a flowchart illustrating aspects of an example produced fluiddensity advanced regulatory control system.

FIG. 17 is a flowchart illustrating aspects of an example produced fluidcomposition calculator QA/QC perceptron.

FIG. 18 is a flowchart illustrating layered aspects of an example neuralnetwork.

DETAILED DESCRIPTION

Wellhead produced fluid (e.g. emulsion) primarily consists of water andbitumen so physical properties of these two components could be used togenerate emulsion composition estimates. However, unlike the compositionand physical properties of water which do not significantly changeduring the course of operation of a hydrocarbon recovery system such asa SAGD (steam assisted gravity drainage) system, those of bitumen maychange as the production reservoir matures. More specifically, in someinstances, bitumen have been observed to become lighter as a SAGDreservoir ages. In addition, produced fluid may be contaminated withfree gas and/or solid particles which may cause a sometimes significantchange in the produced fluid's physical properties.

The present disclosure describes systems, devices, and methods forestimating produced fluid compositions which may, in some embodiments,account for one or more of these dynamic produced fluid characteristics.In some embodiments, aspects of the present disclosure may estimateproduced fluid compositions based on sensor or other input device datawhile addressing variations in the produced fluid flow.

In some embodiments, the system is configured to generate and outputsignals identifying the produced fluid as being a clean emulsion, asincluding solids, and/or as including gas. Flow and Coriolis meters aregenerally not able to provide an indication of the presence of solids orgas in the production line. As these can potentially cause damage topump or meters, or may be generally undesirable, in some embodiments,the system can generate alerts as to the presence of solids or gas inthe produced fluid being conducted from the reservoir.

In some embodiments, the system may be configured to generate an alertif the composition indicates that there is too much water or steam inthe produced fluid as this may be indicative of breakthrough orinsufficient injection well pressure.

In some embodiments, outputs the methods and systems described hereinmay be used to calibrate or otherwise monitor the outputs of one or moremeters in the system.

FIG. 1A shows an example of a steam assisted gravity drainage (SAGD)well 155 in a geological resource 110. In SAGD, production is typicallyeffected by a pair of wells 155: an injector well 150 for injectingsteam and/or other production inducing material into the geologicalformation, and a producer well 160 for collecting the resulting bitumen.

FIG. 1B shows a top elevation view of a geological resource 110 havingmany wells (pairs) 155. The well(s) may be part of one or more SAGDprojects for extracting the hydrocarbon resources in the geologicalformation. As illustrated by the example project in FIG. 1B, theseprojects may have any number of wells 155 having any number oforientations and locations. The project(s) may include one or morefacilities 120 such as well pads, plants, water sources, controlsystems, monitoring systems, steam generators, upgraders and any otherinfrastructure for extracting and/or processing input and outputmaterials.

The systems in FIGS. 1A and 1B show example steam-assisted gravitydrainage (SADG) systems; however, in other embodiments, aspects of thepresent disclose may be applied to other systems involving single wellsor other different hydrocarbon recovery processes.

The wells and/or infrastructure can include one or more input devices130 for measuring, detecting or otherwise collecting data regarding thewells and processes. This data can, in some examples, include wellconditions and output or production rates.

In some examples, the input devices 130 can include thermocouples orother temperature sensors, pressure sensors, and the like for measuringtemperature, pressure and/or other conditions within the wells,proximate to the wells, and/or at the surface. In some examples,multiple input devices can be positioned along the length of the wellsto measuring well conditions at various points in or around the lengthof the wells. For example, pressure and/or temperature sensors may bepositioned at the toe of the well, the heel of the well, at the surfaceand/or elsewhere in the project infrastructure. In some examples, inputsensors from reference wells, surrounding production wells, or otherwells may also provide well condition information for a proximate well.

In some examples, inputs devices 130 may include flow sensors at thesurface, at positions along the well and/or within any other projectinfrastructure to provide flow information and/or bitumen productionrates. In some examples, input devices 130 can include sensors,measuring devices, and/or computational devices for determining a well'sproduction rates of a desired hydrocarbon after processing and/orremoval of water and/or other materials. In some examples, the devicesmay include flow meters for measuring total fluid extracted from thewell.

The wells and/or infrastructure can include one or more control devices140 for adjusting the operational inputs of the wells. In some examples,these control devices 140 can include valves, pumps, mixers, boilers,nozzles, sliding sleeves, inflow/injection control devices, drives,motors, relays and/or any other devices which may control or affect theoperational inputs of the wells. In some examples, these controldevice(s) 140 may be configured, controlled or otherwise adjusted tochange operational inputs via signals or instructions received from oneor more processors in the system. For example, one or more of thecontrol devices 140 may include controllers, processors, communicationdevices, electrical switches and/or other circuitry, devices or logicwhich can be configured, instructed or otherwise triggered to changeoperational inputs such as steam injection rates, temperatures,pressures, steam injection locations, pump speeds, water consumptionrates, fuel consumption and any other adjustable or controllable aspectof the system. In some examples, one or more of the control devices 140may be additionally or alternatively controlled by physical mechanisms.

In some embodiments, one or more valves such as a choke valve at thewellhead or elsewhere can include input device(s) 130 which measure orotherwise obtain the travel of a valve stem.

In some embodiments, the input devices 130 may include one or morepressure sensing devices for obtaining emulsion pressure(s) at one ormore locations in the process. In some examples, the emulsion pressurecan be obtained at a wellpad group separator, at an emulsion header, orat any other point after an emulsion choke valve or elsewhere.

The number and location of the input devices 130 and control devices 140in FIGS. 1A and 1B are illustrative examples only as any number,location and/or type of these devices 130, 140 is possible.

In some example embodiments, the input devices 130 can include sensingdevice cables/wires which may run the length of an entire well orportion of a well, and may provide continuous or spaced measurementsalong the length of the cable/wire.

In some embodiments, the producer well 160 may include a pumpingmechanism 131 such as an electrical submersible pump. In someembodiments, the system can include a device for obtaining the speed atwhich the pumping mechanism is operating. In some examples, this devicecan be an input device 130 which measures or otherwise obtains thepumping speed. In other examples, this device can be a control device140 which controls the pumping speed. This speed, whether measured orcontrolled, can be communicated back to a controller/processor in thesystem.

Aspects of the devices, systems and methods described herein may beimplemented in a combination of both hardware and software. Theseembodiments may be implemented on programmable computers. One or morecomputers may include at least one processor, a data storage system(including volatile memory or non-volatile memory or other data storageelements or a combination thereof), and at least one communicationinterface. In some embodiments, computers can include controller(s),control device(s), data acquisition device(s), and/or any other devicefor computing or otherwise handling data. Produced fluid densitygenerators, composition generators, and/or produced fluid viscositygenerators can be implemented on such hardware or software.

Program code may be applied to input data to perform the functionsdescribed herein and to generate output information. The outputinformation may be applied to one or more output or control devices. Insome embodiments, the communication interface may be a networkcommunication interface. In embodiments in which elements may becombined, the communication interface may be a software communicationinterface, such as those for inter-process communication. In still otherembodiments, there may be a combination of communication interfacesimplemented as hardware, software, and combination thereof. In someexamples, devices having at least one processor may be configured toexecute software instructions stored on a computer readable tangible,non-transitory medium.

The following discussion provides many example embodiments. Althougheach embodiment represents a single combination of inventive elements,other examples may include all possible combinations of the disclosedelements. Thus if one embodiment comprises elements A, B, and C, and asecond embodiment comprises elements B and D, other remainingcombinations of A, B, C, or D, may also be used.

The technical solution of embodiments may be in the form of a softwareproduct. The software product may be stored in a non-volatile ornon-transitory storage medium, which can be a compact disk read-onlymemory (CD-ROM), a USB flash disk, or a removable hard disk. Thesoftware product includes a number of instructions that enable acomputer device (personal computer, server, or network device) toexecute the methods provided by the embodiments.

FIG. 2 shows an example system 200 including one or more devices 205which may be used to estimate produced fluid composition. In someexamples, a device 205 may be a computational device such as a computer,server, tablet or mobile device, or other system, device or anycombination thereof suitable for accomplishing the purposes describedherein. In some examples, the device 205 can include one or moreprocessor(s) 210, memories 215, and/or one or more devices/interfaces220 necessary or desirable for input/output, communications, control andthe like. The processor(s) 210 and/or other components of the device(s)205 or system 250 may be configured to perform one or more aspects ofthe processes described herein.

In some examples, the device(s) 205 may be configured to receive oraccess data from one or more volatile or non-volatile memories 215, orexternal storage devices 225 directly coupled to a device 205 oraccessible via one or more wired and/or wirelessnetwork(s)/communication link(s) 260. In external storage device(s) 225can be a network storage device or may be part of or connected to aserver or other device.

In some examples, the device(s) 205 may be configured to receive oraccess data from sensors or input devices 130 in the field orinfrastructure. These sensors or devices 130 may be configured forcollecting or measuring well, infrastructure, operational, and/or othergeological and/or physical data. In some examples, thesensor(s)/device(s) 130 can be configured to communicate the collecteddata to the device(s) 205 and/or storage device(s) 225 via one or morenetworks/links 260 or otherwise. In some examples, the sensors ordevices 130 may be connected to a local computing device 250 which maybe configured to receive the data from the sensors/devices 130 for localstorage and/or communication to the device(s) 205 and/or storagedevice(s) 225. In some examples, data from sensor(s) or device(s) may bemanually read from a gauge or dial, and inputted into a local computingdevice for communication and/or storage.

In some examples, the device(s) 205 may be configured to generate and/ortransmit signals or instructions to one or more control device(s) 140 toapply desired operational inputs/conditions to the wells. Thesesignals/instructions may, in some examples, be communicated via anysingle or combination of networks/links 260. In some examples, thedevice(s) 205 may be configured to send signals/instructions via localcomputing device(s) 250 connected to or otherwise in communication withthe control device(s) 140. In some examples, a local computing device250, display or other device may be configured to communicateinstructions to a person for manual adjustment/control of the controldevice(s) 140.

In some examples, a client device 260 may connect to or otherwisecommunicate with the device(s) 205 to gain access to the data and/or toinstruct or request that the device(s) 205 perform some or all of theaspects described herein.

FIGS. 3, 4 and 5 show aspects of example processes for measuring anestimated produced fluid composition.

Broadly, in some embodiments, the process includes:

-   -   1. Reference water, bitumen, and WCS viscosities and densities        are calculated at wellhead temperatures.    -   2. An Advanced Regulatory Control module is used to curate        emulsion density using a secondary source of data and identify        the presence of free gas or solids in the emulsion.    -   3. ARC's output is used to identify the emulsion as clean,        contaminated with solids or contaminated with free gas. An        educated guess about the emulsion composition is made based on        previous sensor outputs.    -   4. Choke valve feed and discharge side pressures along with its        stem travel are used to calculate emulsion viscosity. A        classification based selector uses this viscosity along with        other process variables to decide whether this emulsion        viscosity has to be converted to emulsion's viscoelastic        viscosity before being used in other parts of the network.    -   5. Emulsion composition QA/QC perceptron is called to configure        the soft sensor to a setup that has the highest chance of        calculating a valid emulsion composition, hence reducing the        number of redundant calculations. This chance is estimated based        on the soft sensor's previous runs.    -   6. Expected emulsion viscosity and density are calculated based        on step 3's initial composition guess and emulsion contamination        status.    -   7. Difference between expected and actual emulsion viscosities        and differences are calculated.    -   8. A recursive algorithm (Gauss-Newton algorithm) is used to        refine the composition guess until expected emulsion viscosities        and densities calculated based on it become sufficiently close        to their measured values.    -   9. Emulsion composition QA/QC perceptron evaluates the        composition reported by step 8 and decides if the soft sensor        has to be run with a different operating configuration to        improve the composition estimate or if emulsion composition        satisfies specific validity criteria or if a valid emulsion        compositing cannot be estimated from the current dataset.

FIG. 4 shows aspects of an example method 400 for sensing an estimatedcomposition of a produced fluid being conducted from the reservoir.

At 410, one or more sensors along the path of the produced fluid beingconducted from the reservoir sense, measure or otherwise obtain one ormore temperatures for the produced fluid. The temperature data from thesensors is transmitted to or is otherwise obtained by one or moredevices for storage at one or more memory devices and/or for processingby density generator(s), viscosity generator(s) and/or compositiongenerator(s).

At 420, flow rate data, pressure data, pump speed data and/or valvetravel data is obtained from data from one or more input devices 130. Asdescribed herein or otherwise, in some embodiments, obtaining one ormore of flow rate data, pressure data, and/or pump speed data caninclude processing, computing or otherwise transforming data sensed byone or more sensors into a form suitable for generating densities,viscosities and/or compositions. In some embodiments, this may includeaspects of blocks 316 and 317 in FIG. 3. In some embodiments, pressuredata includes pressures obtained from different locations including butnot limited to well toe pressures, well heel pressures, heel injectionpressures, wellhead produced fluid pressures, and the like. In someembodiments, pressure data includes data obtained from wellhead emulsionand separator pressures.

At 430, a first produced fluid density generator, processor and/or othercomputational device(s) generates a first density for the produced fluidbeing conducted from the reservoir. In some embodiments, the firstdensity is based at least in part on the obtained flow rate data,pressure data, and pump speed data.

In some embodiments, generating the first density includes generating abackup produced density based at least in part on one or more of flowrate data, pressure data, and pump speed data.

In some embodiments, the first produced fluid density generator isconfigured to measure or otherwise obtain from at least one sensingdevice, a produced fluid density. As described herein or otherwise, thefirst produced fluid density generator can be configured to selecteither the measured density or the backup density as the first producedfluid density. In some embodiments, the measured density is selectedwhen it falls within a density range between a water reference densitybased on the measured temperature of the produced fluid and a bitumenreference density based on the measured temperature of the producedfluid. In some embodiments, when the backup density is selected when themeasured density is not within this range.

In some embodiments, the generation of the first density includesaspects of block 331 in FIG. 3.

In some embodiments, the first density generator is configured togenerate a produced fluid contaminant indicator signal. This signal canprovide an indication of whether the first density generator considersthe produced fluid to be a clean emulsion, an emulsion contaminated withsolids or a gas/liquid colloid emulsion.

At 440, a second produced fluid generator, processor and/or othercomputational device(s) generates a second density for the producedfluid being conducted from the reservoir. In some embodiments,generating the second density for the produced fluid (e.g. the emulsion)includes identifying the densities of bitumen, water and a phantomcomponent at the measured temperature of the produced fluid. In someembodiments, the second produced fluid generator includes a neuralnetwork configured to generate the second density based on the densitiesof the bitumen, water and phantom component at the measured temperature.

In some embodiments, the neural network generates the second densitybased on the produced fluid contaminant indicator signal. In someembodiments, the produced fluid contaminant indicator signal is used toselect or activate a neuron branch in the neural network.

In some embodiments, generating the second density for the producedfluid includes aspects of blocks 311 and 321 in FIG. 3.

At 450, a composition generator, processor and/or other computationaldevice(s) generates a phantom component content, a bitumen content, anda water content based on the first and second densities for the producedfluid. In some embodiments, the composition generator includes aniterative convergence tool configured to adjust at least the phantomcomponent content until a material balance of the produced fluid fallswithin a defined threshold or error range. In some embodiments, theiterative convergence tool is based on a material balance of theproduced fluid, and a difference between the first density and thesecond density for the produced fluid.

In some embodiments, the generation of the composition components isbased at least in part on the produced fluid contaminant indicatorsignal.

In some embodiments, generating the phantom component content, bitumencontent and water content include aspects of blocks 312, 323, 319 and/or341 in FIG. 3.

At 460, the composition generator, processor and/or other aspect of thesystem generates outputs representing the final phantom componentcontent, bitumen content and water content after the iterative tool hascompleted its process. In some embodiments, the outputs are displayed ona screen or display panel. In some embodiments, the outputs are storedin one or more storage devices. In some embodiments, the outputs aretransmitted to another device or system for monitoring.

In some embodiments, the outputs are monitored at the local device orremotely to trigger an alert if one or more aspects of the compositionof the produced fluid being conducted from the reservoir violates one ormore thresholds or changes at a rate that violates a threshold. In someinstances, an alert can indicate a problem in one or more aspects of thesystem or an unexpected composition or change in composition for theproduced fluid. In some instances, this may allow for changes to be madein the process with a smaller response time than waiting for lab resultsto determine a produced fluid composition.

For example, in some embodiments, the system can include an alertgenerator to monitor the outputs, and to trigger an alert when the watercontent meets a trigger condition. In some embodiments, the triggercondition is met when the water content is greater than or less than adefined threshold parameter. In some embodiments, the trigger conditionis met when the water content changes by more than a defined thresholdparameter. For example, in some instances, a large water content may beindicative that additional injection pressure may be required in thesystem. In some instances, a large change in water content or steam maybe indicative of breakthrough. In some instance, the generated alert canprovide an early warning of a problem or potential problem.

In some embodiments, the system may include a water cut sensor formeasuring the water cut of the produced fluid being conducted from thereservoir. In some instance, these meters may have a large variance, mayrequire calibration or recalibration, or may be prone to errors orfailure. In some embodiments, the system includes a meter monitorconfigured to compare the output of the water cur sensor with thecomposition outputs (e.g. phantom component content, bitumen content,and/or water content) to determine whether there is a discrepancy. Upondetecting a discrepancy, the meter monitor can be configured to generatealert signals to identify a potential problem with the water cut sensoror to automatically recalibrate the water cut sensor. This may besimilarly applied to any meter or sensor which produces similar outputsto the system described herein.

In some embodiments, the system may include an alert generatorconfigured to generate an alert signal when the produced fluidcontaminant indicator signal indicates that at least one of solids orgas is present the produced fluid. Solids and/or gas in the productionline can be indicative of a problem in the production parameters and/orcan cause damage to pumps and/or meters in the system. In someinstances, the alert signal may provide an early warning to adjustproduction parameters, to shut down production processes, and/or tomitigate potential damage to components in the system.

FIG. 5 shows aspects of an example method 500 for sensing an estimatedcomposition of a produced fluid being conducted from the reservoir. Insome embodiments, similarly numbered aspects as described with respectto FIG. 4 are similar or identical to those in FIG. 5; however, in someembodiments, suitable variations may be used.

At 530, a first viscosity generator, processor and/or othercomputational device(s) generates a first viscosity for the producedfluid being conducted from the reservoir. In some embodiments, the firstviscosity is based at least in part on: the reference density and thereference viscosity of bitumen at the measured temperature of theproduced fluid, the reference density and the reference viscosity ofwater at the measured temperature of the produced fluid, and thereference density and the reference viscosity of the phantom componentat the measured temperature of the produced fluid.

In some embodiments, generation of the first viscosity is based on adispersed phase selection from multiple potential dispersed phases forthe produced fluid.

In some embodiments, the first viscosity generator includes perceptionconfigured to create and maintain a dispersed phase selection matrixfrom previous selections by the perceptron. In some embodiments, theperceptron is configured to generate a dispersed phase selection basedat least in part on the second produced fluid viscosity.

In some embodiments, generating the first viscosity includes aspects ofblocks 313, 314 and 322 in FIG. 3.

At 540, a second viscosity generator, processor and/or othercomputational device(s) generates a second viscosity for the producedfluid being conducted from the reservoir. In some embodiments, thesecond viscosity is based at least in part on the valve travel data,pressure data and flow rate data.

In some embodiments, the second viscosity generator includes a neuralnetwork configured to generate the first viscosity based on thedensities and viscosities of the bitumen, water and phantom component atthe measured temperature. In some embodiments, the neural networkgenerates the second viscosity based on the produced fluid contaminantindicator signal. In some embodiments, the produced fluid contaminantindicator signal is used to select or activate a neuron branch in theneural network.

In some embodiments, generating the second viscosity includes aspects ofblocks 316, 317 and 318 in FIG. 3

At 550, a composition generator, processor and/or other computationaldevice(s) generates a phantom component content, a bitumen content, anda water content based on the first and second densities for the producedfluid. In some embodiments, the composition generator includes aniterative convergence tool configured to adjust at least the phantomcomponent content until a material balance of the produced fluid fallswithin a defined threshold or error range. In some embodiments, theiterative convergence tool is based on a material balance of theproduced fluid, and a difference between the first density and thesecond density for the produced fluid, and/or a difference between thefirst viscosity and the second viscosity for the produced fluid.

In some embodiments, the generation of the composition components isbased at least in part on the produced fluid contaminant indicatorsignal.

In some embodiments, generating the phantom component content, bitumencontent and water content include aspects of blocks 312, 315, 323, 319and/or 341 in FIG. 3.

FIG. 3 shows aspects of an example method 300 for sensing an estimatedcomposition of a produced fluid being conducted from the reservoir. Insome embodiments, the system comprises a soft sensor for sensing orotherwise estimating a produced fluid composition. In some embodiments,the system can identify the presence of significant amounts of solidsand/or free gas in the produced fluid.

In some instances, the systems and methods described herein may beutilized or applied in for SAGD produced fluids such as a SAGD wellheademulsion. In some instances, the systems and methods described hereinmay utilize or may otherwise be applied to existing wells andinstrumentation. Accordingly, in some instances, this may reduce oreliminate the need to install or rely on additional or specializedinstrumentation to detect a wellhead produced fluid composition and/orto identify the presence of amounts of solids and/or free gas in theproduced fluid.

In some embodiments, the system measures, detects, calculates orotherwise receives data streams including emulsion wellhead density,temperature and flow rate; ESP speed; producer heel and toe pressures;injector heel pressure; wellhead emulsion choke valve stem travel; andemulsion pressure after the emulsion choke valve (e.g. wellpad groupseparator pressure or emulsion header pressure).

In some embodiments, the system is configured to sense or otherwiseestimate the composition of the produced fluid. In some examples, theproduced fluid can be the liquid portion of an emulsion which may betreated as consisting of water, bitumen and a phantom component. In someinstances, the phantom component can capture or otherwise compensate forthe long-term lightening of bitumen over time and/or can reduce orprevent the system's parameters and outputs from drifting based on thelong term lightening of bitumen over time.

In some embodiments, the Western Canadian Select crude oil (WCS) can beused as the phantom component. However, in other embodiments, otherphantom components may be used. In some examples, the phantom componentmay be based on a well location or reservoir characteristics. Based onthe drift of the bitumen, in some instances, the phantom componentshould be lighter and/or less viscous than bitumen.

In some embodiments, the phantom component may be immiscible in waterand miscible in bitumen. In some instances, the produced fluidcomposition can be generated as an combination of water and a phantomcomponent/reference bitumen blend (reflecting the production bitumen)with the blend's phantom component being calculated by the system asdescribed herein.

In some embodiments, the system can sense the wellhead emulsion in termsof emulsion reference bitumen, water, phantom component (e.g. WesternCanadian Select), solids, free gas contents. In some instances, the sumof WCS and reference bitumen contents reflect the emulsion's totalbitumen content. Separate reporting may be done to obtain a measure ofbitumen's lightening over time.

In some embodiments, to minimize the impact of input data error andinstrumentation systems' deviations on predicted values, the system'sartificial neural networks are combined with the Gauss-Newtonoptimization algorithm to minimize the overall difference betweenobserved emulsion density and viscosity with their counterpartscalculated by the system. In some instances, the system outputs theresult of this optimization exercise by reporting the average mean rootof the relative difference between emulsion's measured density andviscosity with those calculated from the soft sensor based on itsreported emulsion composition. In some instances, this output can beused for continuous quality assurance/quality control of the systemoutputs.

In some embodiments, a permissive can be installed on this soft sensorthat turns it off if ESP speed drop bellows 5 Hz which can be indicativeof either an upset or a shut-in. This is done since some parts of thissoft sensor are utilizing prior-learning optimization modules. Thesemodules rely on fixed size databases that the soft sensor iscontinuously filling by overwriting oldest entries with newer ones. Byreducing or eliminating data from shut-ins and upsets, the system mayprevent iterative or learning components or databases from includingunrepresentative and noisy data.

In some embodiments, the system includes a deep neural network which caninclude machine learning subroutines that utilize convolutional neuralnetworks, advanced regulatory controls (ARCs) and perceptrons.

At 311, the system generates reference densities for bitumen, water andphantom component models based on the measured temperature of theproduced fluid. In some embodiments, these models are stored, created,or otherwise implemented based on simulations, formulas, models,regression analysis and/or bitumen composition assay information.

In some examples, generating a model or correlation between bitumendensity and temperature data can be done using an ASPEN HYSYS™ petroleumassay tool and bitumen composition assay information.

Equation 1 can provides an acceptable correlation between hydrocarbons'temperature and density. As such, it can be used as a basis to develop asimilar correlation for bitumen.

$\begin{matrix}{\rho = {\phi_{0}\phi_{1}^{- {({1 - \frac{T}{T_{C}}})}^{\phi_{2}}}}} & (1)\end{matrix}$

The critical temperature of bitumen is not known. Thus, it is anothervariable that has to be estimated through regression analysis and isreplaced by ϕ₃ to generate equation 2. This equation cannot be used in alinear regression model to estimate its coefficients due to itsnon-linear nature. As such, it is linearized through manipulationsoutlined in equations 2 to 4.

$\begin{matrix}{\rho = {\phi_{0}\phi_{1}^{- {({1 - \frac{T}{\phi_{3}}})}^{\phi_{2}}}\overset{{Natural}\mspace{14mu}{lof}\mspace{14mu}{of}\mspace{14mu}{both}\mspace{14mu}{sides}}{\rightarrow}}} & (2) \\{{\ln\mspace{14mu}\rho} = \left. {{\ln\mspace{14mu}\phi_{0}} - {\left( {1 - \frac{T}{\phi_{3}}} \right)^{\phi_{2}}\mspace{14mu}\ln\mspace{14mu}\phi_{1}}}\rightarrow \right.} & (3) \\{{\ln\mspace{14mu}\rho} = {{\ln\mspace{14mu}\phi_{0}} + {\left( {1 - \frac{T}{\phi_{3}}} \right)^{\phi_{2}}\mspace{14mu}\ln\mspace{14mu}\phi_{1}^{- 1}}}} & (4)\end{matrix}$

Equation 4 is not explicit in terms of either density or temperature. Assuch, it still cannot be readily used in linear regression models.Further linearization of equation 4 is possible through, for example,Taylor Series expansion or using natural logarithms. However, doing somay reduce the accuracy of the developed model or may even createmathematically insoluble solutions. As such, equation 7's coefficientsare estimated using a combination of optimization and regressionproblems. In other words, ϕ₀ and ϕ₁ are estimated using linearregression model while ϕ₂ and ϕ₃ are estimated via optimizationtechniques with a goal of maximizing R² of fitting of equation 4 intothe data. Results of this fit-optimization are shown in equation 5 andFIG. 6.

$\begin{matrix}{\rho = {{308.7 \times 0.2577^{- {({1 - \frac{T}{1022}})}^{0.4034}}\mspace{14mu} R^{2}} = 0.999}} & (5)\end{matrix}$

Emulsion water reference density is calculated using equation 6 that hasbeen developed by AlChE's DIPPR.

$\begin{matrix}{\rho_{water} = \frac{0.14395}{0.01121^{1 + {({1 - \frac{T}{649.7}})}^{0.05107}}}} & (6)\end{matrix}$

The same approach employed to estimate reference bitumen density may beutilized to estimate reference phantom component (e.g. WCS) density. Insome embodiments, this is based on a petroleum assay which is used tocreate the HYSYS model. Example, resultant density-temperaturecorrelation and associated graph are summarized in equation 7 and FIG.7.

$\begin{matrix}{\rho = {{349.2 \times 0.3132^{- {({1 - \frac{T}{750.2}})}^{0.3611}}\mspace{14mu} R^{2}} = 0.999}} & (7)\end{matrix}$

At 312, the system can use Equation 8 to calculate emulsion densityresidual. This residual outlines the difference between emulsion densitycalculated from the soft sensor's estimated emulsion composition and themeasured density.r ₁(X _(j))=ρ_(emulsion calculated)(X _(j))−ρ_(emulsion measured)  (8)

At 313, the system generates reference viscosities for bitumen, waterand phantom component models based on the measured temperature of theproduced fluid. In some embodiments, these models are stored, created,or otherwise implemented based on simulations, formulas, models,regression analysis and/or bitumen composition assay information.

An example bitumen viscosity at varying temperatures has been measuredthrough laboratory analysis. Equation 9 is fitted into this data togenerate a correlation between process temperature and pure bitumenviscosity. Results of this fit are summarized in equation 10 and FIG. 8.ln [ln(μ)]=κ₀+κ₁ ln T  (9)ln [ln(μ_(B))]=16.23−2.369 ln T R ²=0.994  (10)

In some embodiments, water viscosity is calculated using equation 11.

$\begin{matrix}{\mu_{W} = {2.414 \times 10^{- 5} \times 10^{(\frac{247.8}{T - 140})}}} & (11)\end{matrix}$

Similar to the viscosity of bitumen at various temperatures, the phantomcomponent can be similarly tested to generate a model for the viscosityof the phantom component at various temperatures. In some embodiments,the phantom component is WCS. In one example sample, WCS viscositieswere estimated using ASPEN HYSYS™ and the petroleum assay generated forWCS. In some instances, HYSYS is able to produce relatively accurateviscosity estimates if heavy oil's residue and bulk viscosities areprovided to it. Similar to bitumen viscosity correlation developmentoutlined in with respect to block 313, equation 9 is fitted intoviscosity vs. temperature data to generate equation 12 and FIG. 9.ln [ln(10×μ_(WCS))]=17.953−2.801 ln T R ²=0.994  (12)

At 314, the system determines a hydrocarbon phase viscosity. In somesituations, emulsions can be considered to consist of two distinctphases: water phase and hydrocarbon phase. Therefore, the relationbetween emulsion composition and viscosity should account forinteractions both between and within phases. This may be done by firstestablishing a relationship between hydrocarbon phase's viscosity andemulsion composition (block 314) and then using this relation indevelopment of a link between overall emulsion viscosity and emulsioncomposition (block 322).

In some embodiments, the hydrocarbon phase is comprised of bitumen andWCS. Since both of these compounds are hydrocarbons and miscible in eachother, the Refutas hydrocarbon blend viscosity calculation method isused to establish a relationship between hydrocarbon phase's viscosityand emulsion composition. In some embodiments, this method includes:

-   -   1. Bitumen and WCS viscosities at process temperature are        calculated (block 313).    -   2. Bitumen and WCS densities at process temperature are        calculated (block 311).    -   3. Bitumen and WCS kinematic viscosities at process temperature        are calculated using equation 13.        ν=μρ⁻¹  (13)    -   4. Bitumen and WCS blending numbers are calculated using        equation 14.        VBN=14.53×ln [ln(ν[cSt]+0.8)]+10.98  (14)    -   5. Hydrocarbon phase's total blending number is calculated using        equation 15.

$\begin{matrix}{{VBN}_{HC} = {{\frac{x_{B}}{x_{B} + x_{WCS}}{VBN}_{B}} + {\frac{x_{WCS}}{X_{B} + x_{WCS}}{VBN}_{WCS}}}} & (15)\end{matrix}$

-   -   6. Hydrocarbon phase's kinematic viscosity is calculated using        equation 16.

$\begin{matrix}{{v_{HC}\lbrack{cSt}\rbrack} = {{\exp\left( {\exp\left( \frac{{VBN}_{HC} - 10.98}{14.53} \right)} \right)} - 0.8}} & (16)\end{matrix}$

-   -   7. Hydrocarbon phase's density is calculated using equation 17.

$\begin{matrix}{\rho_{HC} = \left( {\frac{x_{B}}{\rho_{B}\left( {x_{B} + x_{WCS}} \right)} + \frac{x_{WCS}}{\rho_{WCS}\left( {x_{B} + x_{WCS}} \right)}} \right)^{- 1}} & (17)\end{matrix}$

-   -   8. Hydrocarbon phase's dynamic viscosity is calculated using        equation 18.

(18)μ_(HC)=ν_(HC)ρ_(HC)  (18)

At 315, equation 19 is used to calculated emulsion viscosity residual.This residual outlines the difference between emulsion viscositycalculated from the current estimated emulsion composition and themeasured viscosity.r ₂(X _(j))=μ_(emulsion calculated)(X _(j))−μ_(emulsion measured)  (19)

A valve flow coefficient (block 316) is a measure of a valve'sefficiency at countenancing fluid flow and is defined in imperial unitsas outlined in equation 20. For calculation purposes, valve feed portpressure may be assumed to be equal to wellhead emulsion pressure andvalve discharge port pressure may be assumed to be equal to that of thewellpad emulsion header. Emulsion flow and specific gravity are obtainedfrom wellhead coriolis meter readings.

$\begin{matrix}{C_{v} = {{F\mspace{14mu}\lbrack{USGPM}\rbrack}\sqrt{\frac{SG}{\Delta\;{P\mspace{14mu}\lbrack{PSI}\rbrack}}}}} & (20)\end{matrix}$

A typical choke valve characteristic curve outlining the relationbetween valve flow coefficient and stem travel is shown in FIG. 10. Asthis figure shows, shape of choke valve characteristic curve is similarto that of a logistic function. Hence, the system determines theexpected flow coefficient of the valve in two steps (block 316). First,a logistic equation, outlined in equation 21, is fitted into the chokevalve's datasheet flow coefficient vs. stem travel information asdescribed below. Then, the valve's expected flow coefficient at anymoment is calculated by plugging the valve's stem travel recorded by DCSinto the valve's C_(v) logistic function.

$\begin{matrix}{{C_{v}({Expected})} = \frac{A_{o}}{1 + {\exp\left( {- {A_{1}\left\lbrack {{Travel} + A_{2}} \right\rbrack}} \right)}}} & (21)\end{matrix}$

Equation 21 can be linearized to simplify the process of fitting it intochoke valve datasheet information. This is done by first inversing bothsides of equation 21 to generate equation 22. This equation is thenmodified into equation 23. Finally, the natural logarithm of both sidesof equation 23 is taken to generate equation 24.C _(V) ⁻¹(Expected)=A _(o) ⁻¹ +A _(o) ⁻¹ exp(−A ₁[Travel+A ₂])  (22)C _(V) ⁻¹(Expected)−A _(o) ⁻¹ =A _(o) ⁻¹ exp(−A ₁[Travel+A ₂])  (23)ln(C _(V) ⁻¹(Expected)−A _(o) ⁻¹ =lnA _(o) ⁻¹ −A ₁Travel−A ₁ A ₂  (24)

Equation 24 is not explicit in terms of either valve travel or expectedflow coefficient. As such, it cannot still be readily used in linearregression models. Thus, equation 24's coefficients are estimated usinga combination of optimization and regression problems. In other words,A₂ and A₁ are estimated using a linear regression model while A_(o) isestimated via optimization techniques with a goal of maximizing thelinear regression model's R². Assuming that Microsoft Excel™ is used toperform this optimization-linear regression operation, the producedfunction will have a setup similar to equation 25 with Excel explicitlyreporting A_(o) as the output of its solver function. Hence, A₁ and A₂are estimated as outlined in equations 26 and 27 respectively.

$\begin{matrix}{{\ln(y)} = {B_{o} + {B_{1}x}}} & (25) \\{A_{1} = {- B_{1}}} & (26) \\{A_{2} = \frac{B_{o} - {\ln\mspace{14mu} A_{o}^{- 1}}}{- A_{1}}} & (27)\end{matrix}$

Valves' published flow coefficients are generally determined using wateras the flow medium. Hence the effect of viscosity on flow coefficientsis not reflected in them. This neglected viscosity effect is quantifiedby defining a flow coefficient correction factor as outlined in equation28. The relationship between this factor and flow's valve Reynoldsnumber (shown in FIG. 11) is exploited to estimate the flow's viscositysince flow's valve Reynolds number has an inverse relationship with thevalve's viscosity as shown in equation 29.

$\begin{matrix}{F_{V} = \frac{C_{v}({Realized})}{C_{v}({Expected})}} & (28) \\{N_{R} = \frac{1.725 \times 10^{- 5} \times {Q\lbrack{USGPM}\rbrack}\mspace{11mu}\rho}{\sqrt{C_{v}({Expected})}\mu}} & (29)\end{matrix}$

In some embodiments, based on the above, the system generates theproduced fluid viscosity. First, the valve flow coefficient correctionfactor is calculated using equation 28. This correction factor is thensubstituted into equation 30, which has been obtained from FIG. 11, toestimate the fluid's valve Reynolds number. Finally, this estimatedReynolds number is substituted in equation 31, which is a re-arrangementof equation 29, to estimate emulsion's viscosity.

$\begin{matrix}{N_{R} = {{{{\exp\left( {{{- 1.761}\mspace{14mu}{\ln\left( {\ln\mspace{11mu} F_{v}} \right)}} + 4.126} \right)}\mspace{20mu} 1} \leq F_{v} \leq {2.2\mspace{20mu} R^{2}}} = 0.991}} & (30) \\{\mspace{79mu}{\mu = \frac{1.725 \times 10^{- 5} \times {Q\lbrack{USGPM}\rbrack}\mspace{11mu}\rho}{\sqrt{C_{v}({Expected})}N_{R}}}} & (31)\end{matrix}$

In some instances, the presence of flow coefficient correction factorssmaller than one causes equation 30 to be insolvable in the real numbersdomain. Choke valve's expected flow coefficient being smaller than itsrealized value leads to equation 32 which is based on equation 30. Thisequation does not have a solution in the domain of real numbers.However, equation 32 can be written into equation 33 via expansion ofthe model's numerical domain from real to complex numbers andapplication of the Complex Logarithmic Number principle. Re-arrangingthis equation to separate its complex and real parts leads to equation34 and application of Euler's formula to equation 34 leads to equation35; this equation provides a complex estimate of the choke valve'sReynolds number in situations in which the flow coefficient correctionfactor is less than one.

$\begin{matrix}{N_{R} = {\exp\left( {{{- 1.761}\mspace{14mu}{\ln\left( {- {{\ln\mspace{11mu} F_{v}}}} \right)}} + 4.126} \right)}} & (32) \\{N_{R} = {\exp\left( {{- {1.761\;\left\lbrack {{\ln\left( {{\ln\mspace{11mu} F_{v}}} \right)} + {i\;\pi}} \right\rbrack}} + 4.126} \right)}} & (33) \\{N_{R} = {e^{{{- 1.761}\mspace{11mu}{\ln{({{\ln\mspace{11mu} F_{v}}})}}} + 4.126}e^{{- 1.761}i\;{\pi\overset{e^{{{- 1.761}\mspace{11mu}{\ln{({{\ln\; F_{v}}})}}} + 4.126} = \psi}{\longrightarrow}}}}} & (34) \\{N_{R} = {{\psi\mspace{11mu}{\cos\left( {{- 1.761}\mspace{11mu}\pi} \right)}} + {i\;\psi\mspace{11mu}{\sin\left( {{- 1.761}\mspace{11mu}\pi} \right)}}}} & (35)\end{matrix}$

As discussed above, emulsion viscosity is calculated by substitutingchoke valve's Reynolds number into equation 31. Doing so in thissituation, i.e. substituting equation 35 into equation 31, leads toequation 36. Manipulations outlines in equations 36 to 39 turn equation36 into equation 40.

$\begin{matrix}{\mu = {\frac{1.725 \times 10^{- 5} \times {Q\lbrack{USGPM}\rbrack}\mspace{11mu}\rho}{\sqrt{C_{v}({Expected})}\left( {{\psi\mspace{11mu}{\cos\left( {{- 1.761}\mspace{11mu}\pi} \right)}} + {i\;{{\psi sin}\left( {{- 1.761}\mspace{11mu}\pi} \right)}}} \right)}\overset{\frac{1.725 \times 10^{{- 5} \times {Q{\lbrack{USGPM}\rbrack}}\mspace{11mu}\rho}}{\sqrt{C_{v}{({Expected})}}}}{\longrightarrow}}} & (36) \\{\mu = {\frac{\varsigma}{\left( {{\psi\mspace{11mu}{\cos\left( {{- 1.761}\mspace{11mu}\pi} \right)}} + {i\;\psi\mspace{11mu}{\sin\left( {{- 1.761}\mspace{11mu}\pi} \right)}}} \right)} \times \frac{\left( {{\psi\mspace{11mu}{\cos\left( {{- 1.761}\mspace{11mu}\pi} \right)}} - {i\;\psi\mspace{11mu}{\sin\left( {{- 1.761}\mspace{11mu}\pi} \right)}}} \right)}{\left( {{\psi\mspace{11mu}{\cos\left( {{- 1.761}\mspace{11mu}\pi} \right)}} - {i\;{{\psi sin}\left( {{- 1.761}\mspace{11mu}\pi} \right)}}} \right)}}} & (37) \\{\mspace{79mu}{\mu = {\frac{\varsigma\left( {{\psi\mspace{11mu}{\cos\left( {{- 1.761}\mspace{11mu}\pi} \right)}} - {i\;\psi\mspace{11mu}{\sin\left( {{- 1.761}\mspace{11mu}\pi} \right)}}} \right)}{\left( {{\psi^{2}\mspace{11mu}{\cos^{2}\left( {{- 1.761}\mspace{11mu}\pi} \right)}} + {\psi^{2}\mspace{11mu}{\sin^{2}\left( {{- 1.761}\mspace{11mu}\pi} \right)}}} \right)}\overset{{{{\sin^{2}x} + {\cos^{2}x}} = 1}\;}{\longrightarrow}}}} & (38) \\{\mspace{79mu}{\mu = \frac{\varsigma\mspace{11mu}\left( {{\psi\mspace{11mu}{\cos\left( {{- 1.761}\mspace{11mu}\pi} \right)}} - {i\;{{\psi sin}\left( {{- 1.761}\mspace{11mu}\pi} \right)}}} \right.}{\psi^{2}}}} & (39) \\{\mspace{79mu}{\mu = {\frac{\varsigma\mspace{11mu}{\cos\left( {{- 1.761}\mspace{11mu}\pi} \right)}}{\psi} - {\frac{\varsigma\mspace{11mu}{\sin\left( {{- 1.761}\mspace{11mu}\pi} \right)}}{\psi}i}}}} & (40)\end{matrix}$

The viscosity function shown in equation 40 refers to a specific type ofviscosity known as the complex viscosity. In general, the real part ofthis equation is equal to the mixture's dynamic viscosity and theimaginary part of it is a measure of the mixture's elasticity. Hence,emulsion's dynamic viscosity in situations in which the choke valve'sflow coefficient correction factor is less than one is calculated usingequations 41 to 43.

$\begin{matrix}{\mu = \frac{\varsigma\mspace{11mu}{\cos\left( {{- 1.761}\mspace{11mu}\pi} \right)}}{\psi}} & (41) \\{\varsigma = \frac{1.725 \times 10^{- 5} \times {Q\lbrack{USGPM}\rbrack}\mspace{11mu}\rho}{\sqrt{C_{v}({Expected})}}} & (42) \\{\psi = e^{{{- 1.761}\mspace{11mu}{\ln{({{\ln\mspace{11mu} F_{v}}})}}} + 4.126}} & (43)\end{matrix}$

In some embodiments, the system attempts to minimize the overallresidual of its core functions. Performance may be monitored byestimating the root mean square of emulsion viscosity and densityresiduals as outlined in equation 44. As such, output of thiscomputation is used for model quality assurance. This residual is alsoused as a basis for the algorithm termination block 319. In someembodiments, the soft sensor's emulsion composition estimation algorithmis terminated and the latest iteration's emulsion composition estimateis deemed to be the final one if number of iterations exceeds a definednumber (e.g. 1000) or R(X_(j+1)) drops to below a defined threshold (e.g0.02). In some embodiments, the system only terminates the compositionestimation iteration tool and not the larger neural network which iscontrolled by the QA/QC Perceptron at 341. In the termination block, thesystem identifies a emulsion composition estimate that provides areasonable solution to the composition estimation process and activatesthe perceptron. In some embodiments, the perceptron is configured toevaluate the estimated composition and if it deems the estimate a validvalue, it will terminate the whole neural network process. Otherwise, itmay adjusts neural network's configuration and restart the compositionestimation process.

$\begin{matrix}{{r_{t}\left( X_{j + 1} \right)} = \sqrt{{0.5\frac{r_{1}^{2}\left( X_{j + 1} \right)}{\rho_{{emulsion}\mspace{14mu}{measured}}^{2}}} + {0.5\frac{r_{2}^{2}\left( X_{j + 1} \right)}{\mu_{{emulsion}\mspace{14mu}{measured}}^{2}}}}} & (44)\end{matrix}$

At 321, the system generates a produced fluid density. In someembodiments, the system aspects for generating the produced fluiddensity at 321 include a neural network such as a convolutional neuralnetwork. In some embodiments, the neural network is trained to performoverlapping density estimation analyses.

In some embodiments, in an effort to achieve a faster convergence, theneural network includes a selector that receives a produced fluidcontaminant (e.g. gas/solid/no-contaminant) signal from the emulsiondensity ARC and only awakens the neuron(s) corresponding to the ARCsignal. In some embodiments, three neurons/neuron sets/branches embeddedin the neural network each determine the density of a clean emulsion(i.e. an emulsion with no free gas or solids), an emulsion contaminatedwith free gas, and an emulsion contaminated with solids using theemulsion composition node's data and reference densities. FIG. 12 showsaspects of an example neural network including the three neural networkbranches which may be selected by the produced fluid contaminant signal.

For a clean emulsion density, the relation between emulsion density andcomposition in absence of free gas and solids is outlined in equation45. In some embodiments, emulsion density is generated in block 331, andreference bitumen, water and phantom component (e.g. WCS) densities aregenerated in block 311.

$\begin{matrix}{\rho_{emulsion}^{- 1} = {\frac{x_{bitumen}}{\rho_{bitumen}} + \frac{x_{water}}{\rho_{water}} + \frac{x_{WCS}}{\rho_{WCS}}}} & (45)\end{matrix}$

The relation between emulsion density and composition in presence ofsolids is outlined in equation 46. In some embodiments, emulsion densityis generated in block 331, and reference bitumen, water and phantomcomponent (e.g. WCS) densities are generated in block 311. In someembodiments, solid density may be deemed to be 2320 kg/m³ which is thedensity of silica (sand).

$\begin{matrix}{\rho_{emulsion}^{- 1} = {\frac{x_{bitumen}}{\rho_{bitumen}} + \frac{x_{water}}{\rho_{water}} + \frac{x_{WCS}}{\rho_{WCS}} + \frac{x_{S}}{\rho_{S}}}} & (46)\end{matrix}$

The relation between emulsion density and composition in presence offree gas is outlined in equation 47. In some embodiments, emulsiondensity is generated in block 331, and reference bitumen, water andphantom component (e.g. WCS) densities are generated in block 311. Insome embodiments, free gas may be deemed to be saturated steam atwellhead conditions and so its density is calculated using equation 48and 49

$\begin{matrix}{\mspace{79mu}{\rho_{emulsion}^{- 1} = {\frac{x_{bitumen}}{\rho_{bitumen}} + \frac{x_{water}}{\rho_{water}} + \frac{x_{WCS}}{\rho_{WCS}} + \frac{x_{gas}}{\rho_{gas}}}}} & (47) \\{\rho_{gas} = {322 \times {\exp\left( {{{- 2.03}\tau^{\frac{1}{3}}} - {2.68\tau^{\frac{2}{3}}} - {\quad\left. \quad{{5.386\tau^{\frac{4}{3}}} - {17.30\tau^{3}} - {44.76\tau^{\frac{37}{6}}} - {63.92\tau^{\frac{71}{6}}}} \right)}} \right.}}} & (48) \\{\mspace{79mu}{\tau = {1 - \frac{T_{wellhead}}{647.1}}}} & (49)\end{matrix}$

At 322, the system generates a produced fluid viscosity. In someembodiments, the system aspects for generating the produced fluiddensity at 321 include a neural network such as a convolutional neuralnetwork. In some embodiments, the neural network is trained to performoverlapping viscosity estimation analyses. In some embodiments, in aneffort to achieve a faster convergence, the neural network includes aselector that receives a produced fluid contaminant (e.g.gas/solid/no-contaminant) signal from the emulsion density ARC and onlyawakens the neuron(s) corresponding to the ARC signal. In someembodiments 1 or 2 neuron branches can be activated.

FIG. 13 shows aspects of an example neural network including the threeneural network branches which may be selected by the produced fluidcontaminant signal.

The emulsion viscosity philosophy is that hydrocarbon and water phasesalways exist as an emulsion in the system with any present contaminantfree gas or solid turning the mixture into a colloid withwater-hydrocarbon emulsion acting as the dispersant phase and freegas/solid acting as the dispersed phase. Therefore, in some embodiments,the clean emulsion viscosity neuron always calculates the viscosity ofthe water-hydrocarbon emulsion and reports the calculation results tothe CNN's selector. This selector then uses the emulsion density ARC'scontamination signal to decide if solids or free gas neurons have to beawaken to adjust the emulsions viscosity.

Three neurons embedded in this CNN calculate the viscosity of a cleanemulsion (i.e. an emulsion with no free gas or solids), an emulsioncontaminated with free gas, and an emulsion contaminated with solidsusing the emulsion composition node's data.

Asphaltene and resins act as surfactants in water-hydrocarbon emulsion.Therefore, based on Bancroft's role of thumb, which states that thephase in which surfactant dissolves preferably constitutes theemulsion's continuous phase, hydrocarbon must constitute the emulsion'scontinuous phase. However, emulsion viscosities calculated based on thisobservation are significantly higher than emulsion's measuredviscosities. This inconsistency is resolved by treating the emulsion asa water-hydrocarbon-water emulsion. Thus, the viscosity of this emulsionis calculated in four steps. First, maximum water and hydrocarbondroplet diameters in this emulsion are calculated by the system. Second,these diameters are used by the system to estimate the fraction ofemulsion water present in the bitumen phase as droplets. Third, thisfraction is used by the system to calculate the bitumen phase'sviscosity. Finally, bitumen phase's viscosity is used to calculateemulsion's viscosity given its composition.

In some instances, this approach may not fully address the peculiaritiesobserved in emulsion viscosity calculations. Due to bitumen's highviscosity and salt content, determination of emulsion's disperse andcontinuous phases is not clear cut. In other words, it may not be clearif emulsion's continuous phase is bitumen contaminated with waterdroplets and its dispersed phase is “free water” or vice versa. Tofurther complicate the matter, neither of phases is dilute enough forits droplets to be assumed to be isolated from each other if that phaseconstitutes the dispersed phase. These two issues have to be mitigatedfor the sensor's model to be an accurate reflection of the wellheadstate.

In some embodiments, the system includes a perception which, in someinstances, may mitigate the first problem. In some embodiments, thePerception comprises or is configured to utilize a Bayesian machinelearning algorithm. In some embodiments, the perceptron can perform twotasks. First, it may verify that, at each time point, the correctdispersed phases is selected by evaluating the validity of estimatedemulsion compositions and changing the dispersed phase selection ifrequired. Second, it monitors and stores past results, and updatesfuture selections which may, in some instances, reduce the number ofwrong dispersed phase selections that it performs.

The second problem is mitigated by using the Yaron & Gal-Or model ofconcentrated emulsions which accounts for interactions both betweenphases and between dispersed phase's droplets to estimate wellheademulsion's viscosity. The first major assumption of this model is thatthe emulsion's Capillary Number, i.e. the relative effect of viscousforces vs. surface tension across the interfacial interface, is small.This assumption is valid in this study as the wellhead emulsion, andoil-in-water emulsions in general, have small Capillary Numbers due totheir strong interfacial surface tensions. The second major assumptionof this model is that both phases of emulsion are Newtonian fluids. Thisassumption is valid in this study since water is a Newtonian fluid andbitumen behaves as Newtonian fluid at high temperatures experienced bythe wellhead emulsion. In summary, Yaron & Gal-Or model of concentratedemulsions is used to estimate emulsion viscosity as neither ofemulsion's water or hydrocarbon phases are dilute enough to deemdroplets formed from it to be isolated from each other.

Equation 50 provides an estimation of maximum dispersed phase dropletdiameter in an emulsion formed in a viscous turbulent fluid. The systemevaluates this equation twice with one evaluation performed for water inhydrocarbon emulsion (i.e. the inner emulsion) and the other performedfor hydrocarbon in water emulsion (i.e. the outer emulsion). C₁ and C₂are constants equal to 0.7 and 2 respectively. Estimates of dispersedphase viscosities and densities are received from blocks 311, 313 and314. Derivations of general formulas for calculating turbulent flowenergy dissipation rate and hydrocarbon-water interfacial tension aredescribed herein.

$\begin{matrix}{d_{D} = {\left( \frac{4}{C_{1}C_{2}} \right)^{3/5}\left( {1 + \frac{C_{2}^{0.5}\mu_{Dispersed}\mspace{11mu} ɛ^{1/3}d_{D}^{1/3}}{4\sigma_{W - {HC}}}} \right)\mspace{11mu}\sigma_{W - {HC}}^{3/5}\rho_{Continuous}^{{- 3}/5}\mspace{11mu} ɛ^{{- 2}/5}}} & (50)\end{matrix}$

Equation 51 and 52 outline the general formulas used to estimate amixture's interfacial tension. While these equations were originallydeveloped for spherical molecules, they provide valid approximations fornon-spherical molecules as well. Utilizing these equations require theknowledge of water and hydrocarbon's surface tensions along with theirmolar volumes. Molar volumes of water and hydrocarbon are calculatedusing equations 53 and 54 and density estimates are obtained byprocesses as described for blocks 311 and 314. In some instances, thesystem is configured to presume water molar mass to be about 18 g/moland molar mass of hydrocarbon to be about 607 g/mol. Water's surfacetension is well examined and its value at different temperatures iscalculated using equation 55. A similar temperature-surface tensioncorrelation is generated for hydrocarbon by fitting hydrocarbon surfacetension of 0.026 J/m² at 23° C. into equation 56, which is derived onthe basis of principle of corresponding states, to generate equation 57.Equation 56 is a modification of its original form with all of itsoriginal form's melting temperatures and molar volumes replaced bycritical temperature and molar volumes. This is done per the principleof corresponding states and as hydrocarbon has a softening point insteadof a melting point. For purposes of this equation, hydrocarbon'spseudo-critical temperature is deemed to be 1022° C.

$\begin{matrix}{\mspace{79mu}{\sigma_{W - {HC}} = {\sigma_{W} + \sigma_{HC} - {2{\Omega\left( {\sigma_{W}\sigma_{HC}} \right)}^{0.5}}}}} & (51) \\{\mspace{79mu}{\Omega = \frac{4V_{W}^{1/3}V_{HC}^{1/3}}{\left( {V_{HC}^{1/3} + V_{HC}^{1/3}} \right)}}} & (52) \\{\mspace{79mu}{V_{W} = {\frac{M_{W}}{\rho_{W}} = \frac{0.018}{\rho_{W}}}}} & (53) \\{\mspace{79mu}{V_{B} = {\frac{M_{B}}{\rho_{B}} = \frac{\frac{{0.607x_{B}} + {0.491x_{WCS}}}{x_{B} + x_{WCS}}}{\rho_{HC}}}}} & (54) \\{\mspace{79mu}{\sigma_{W} = {{0.2358\;\left\lbrack \frac{647.15 - T}{647.15} \right\rbrack}^{1.256}\left\lbrack {1 - {0.625\mspace{11mu}\left( \frac{647.15 - T}{647.15} \right)}} \right\rbrack}}} & (55) \\{\sigma_{HC} = \left. {2.746 \times 10^{24}{\frac{{k\left\lbrack {= {1.858 \times 10^{- 32}}} \right\rbrack}{T_{C}\left\lbrack {= 1022} \right\rbrack}}{V_{{HC} - C}\left\lbrack {= 0.00197} \right\rbrack}\left\lbrack {1 - {0.13\mspace{11mu}\left( {\frac{T}{T_{c}\left\lbrack {= 1022} \right\rbrack} - 1} \right)}} \right\rbrack}^{167}}\rightarrow \right.} & (56) \\{\mspace{79mu}{\sigma_{HC} = {0.0265\;\left\lbrack {1 - {0.13\mspace{11mu}\left( {\frac{T}{1022} - 1} \right)}} \right\rbrack}^{1.67}}} & (57)\end{matrix}$

Equation 58 provides an approximation of the emulsion's turbulent flowenergy dissipation rate. Most of the relevant energy dissipation occursbetween ESP's discharge and choke valve. Therefore, fluid pressurerequired for this equation is calculated using equation 59 and fluid'seffective volume is calculated using equation 60 with the rest ofvariables being read off of their respective data streams.

$\begin{matrix}{ɛ = \frac{PF}{\rho_{continuous}V_{Eff}}} & (58) \\{P = {\frac{1}{2}\left( {{P_{{ESP}\mspace{14mu}{Discharge}}\;\left\lbrack {{From}\mspace{14mu}{{Eq}.\; 128}} \right\rbrack} + P_{Wellhead}} \right)}} & (59) \\{V_{Eff} = {\pi\; R_{{prod}\mspace{11mu}{string}}^{2}z_{{ESP} - {MD}}}} & (60)\end{matrix}$

Wellhead emulsion is a water-hydrocarbon-water emulsion with some ofemulsion's water existing as a dispersed phase within the emulsion'shydrocarbon phase which itself exists as a dispersed phase in theremaining portion of emulsion's water. Looking at the emulsion's travelfrom wellbore to wellhead, it is logical to claim that emulsion exitsthe wellbore's ESP as a well-mixed solution due to ESP's high speed.From here towards the wellhead, emulsion evolves into awater-hydrocarbon-water emulsion that minimizes the total amount of itsinterfacial free energy. Denoting the fraction of emulsion's waterexisting as droplets in hydrocarbon with Y, this free energy is definedas equation 61 and 62 with different parts of these equations describedbelow. The reference state from which this equation is defined is waterand hydrocarbon existing as completely separate phases.ΔG _(IF) =ΔW _(Water Droplet) +ΔW _(HC Droplet) −TΔS  (61)ΔG _(IF) =W _(Water Droplet-Final) +W _(HC Droplet-Final) −W _(Initial)−T(S _(Emulsion) −S _(Reference))  (62)

Total energy of interfacial tension created by water droplets iscalculated using equation 63 with equation 64 providing an estimate oftotal surface area of water droplets suspended in hydrocarbon.Substituting equation 64 into equation 63 leads to equation 65 whichprovides an estimate of the total interfacial tension created by theformation water droplets as a function of the portion of emulsion'stotal water represented by those droplets.

$\begin{matrix}{\mspace{79mu}{W_{{{Water}\mspace{14mu}{Droplet}} - {Final}} = {a_{{Water}\mspace{14mu}{Droplet}}\sigma_{W - B}}}} & (63) \\{{A_{{Water}\mspace{14mu}{Droplet}}\frac{V_{Total}}{V_{Droplet}}A_{Droplet}} = {{\left( \frac{m_{Water}}{\rho_{Water}} \right)\left( {\frac{1}{6}\pi\; d_{d - w}^{2}} \right)^{- 1}\left( {\pi\; d_{d - w}^{2}} \right)} = \frac{6\Upsilon\; x_{Water}}{\rho_{Water}d_{d - W}}}} & (64) \\{\mspace{79mu}{{W_{{{Water}\mspace{14mu}{Droplet}} - {Final}}(\Upsilon)} = {\left\lbrack \frac{6\sigma_{W - B}x_{Water}}{\rho_{Water}d_{d - W}} \right\rbrack\Upsilon}}} & (65)\end{matrix}$

Total energy of interfacial tension created by hydrocarbon droplets iscalculated using equation 66. The total volume of hydrocarbon phase isdeemed to be equal to sum of volumes of water and hydrocarbon dropletsas it is assumed that all of water droplets are suspended in thehydrocarbon phase. Therefore, equation 67 provides an estimate ofhydrocarbon droplets total surface area. Combining equations 67 and 66leads to equation 68. This equation provides an estimate of the totalinterfacial tension created by the formation of hydrocarbon droplets asa function of the portion of emulsion's total water represented by waterdroplets present in the hydrocarbon phase.

$\begin{matrix}{\mspace{79mu}{W_{{{HC}\mspace{14mu}{Droplet}} - {Final}} = {A_{{HC}\mspace{14mu}{Droplet}}\sigma_{W - {HC}}}}} & (66) \\\begin{matrix}{A_{{HC}\mspace{14mu}{Droplet}} = {{\frac{V_{Total}}{V_{Droplet}}A_{Droplet}} = \left( {\frac{m_{Water}}{\rho_{Water}} + \frac{m_{HC}}{\rho_{HC}}} \right)}} \\{\left( {\frac{1}{6}\pi\; d_{d - {HC}}^{3}} \right)^{- 1}\left( {\pi\; d_{d - {HC}}^{2}} \right)} \\{= {\left( {\frac{\Upsilon\; x_{Water}}{\rho_{Water}} + \frac{x_{B} + x_{WCS}}{\rho_{HC}}} \right)\left( \frac{6}{d_{d - {HC}}} \right)}}\end{matrix} & (67) \\\begin{matrix}{{W_{{{HC}\mspace{14mu}{Droplet}} - {Final}}(\Upsilon)} = {\left( {\frac{\Upsilon}{\rho_{Water}} + \frac{x_{B} + x_{WCS}}{\rho_{HC}}} \right)\left( \frac{6\sigma_{W - {HC}}}{d_{d - {HC}}} \right)}} \\{= {{\left\lbrack \frac{6\sigma_{W - {HC}}x_{Water}}{d_{d - {HC}}\rho_{Water}} \right\rbrack\Upsilon} + \left\lbrack \frac{6{\sigma_{W - {HC}}\left( {x_{B} + x_{WCS}} \right)}}{d_{d - {HC}}\rho_{HC}} \right\rbrack}}\end{matrix} & (68)\end{matrix}$

Reference interfacial tension of the system is equal to the interfacialtension of the emulsion in the wellhead pipe with emulsion's water andhydrocarbon being completely separate from each other as shown in FIG.15. Equations 69 and 70 are developed based on this figure and a seriesof calculations to create a relationship between reference state's unitinterface area and emulsion's water content. These equations arecombined with equation 71 to calculate the reference interfacial tensionof the system.

$\begin{matrix}{R_{HC} = {0.001 \times {\exp\;\left\lbrack \frac{{\left( \frac{\rho_{Emulsion}}{\rho_{HC}} \right)\left( {\pi\; R_{Pipe}^{2}} \right)\left( {1 - x_{water}} \right)} - {0.69\mspace{11mu}{\ln\left( {10^{3} \times R_{Pipe}} \right)}}}{1.449} \right\rbrack}}} & (69) \\{A_{{Interface} - {Reference}} = {{2\left\lbrack \frac{\pi\; R_{Pipe}^{2}}{\rho_{Emulsion}} \right\rbrack}\left\lbrack \sqrt{R_{HC}\left( {{2R_{Pipe}} - R_{HC}^{2}} \right)} \right\rbrack}} & (70) \\{\mspace{79mu}{W_{Initial} = {\sigma_{W - {HC}}A_{{Interface} - {Reference}}}}} & (71)\end{matrix}$

It is assumed that emulsion temperature and pressure at wellhead areconstants and that material losses are negligible. Therefore, only waterand hydrocarbon droplets' surface areas can change to accommodatechanges in emulsion's interfacial Gibbs energy (i.e. equation 61). Thismeans that emulsion's interfacial entropy can be calculated usingequation 72 in which S_(A) refers to entropy per unit area. The entropyper surface area value required for this equation is calculated usingequation 73 which is based on the premise that surface tension is equalto the interface's Gibbs free energy per unit area. Since pressure andtotal interface areas are deemed to be constant in the partialderivative outlined by equation 73, derivative of theGuggenheim-Katayama equation, outlined in equation 74, is used tocalculate the interface's unit entropy as outlined in equation 75.Values of n and σ_(W-B) ^(o) are estimated by fitting equation 74 intohydrocarbon-water interfacial tension values obtained at differenttemperatures for the emulsion composition under consideration usingequations 51 to 57. Combining equation 74 with equation 73 and 72 leadsto equation 75 which provides an estimate of interfacial entropy perunit area in the emulsion. Substituting this equation along withequations 67 and 64 into equation 72 leads to equation 76 which providean estimate of emulsion's interfacial entropy.

$\begin{matrix}{S_{Emulsion} = {S_{A}\left( {A_{{Water}\mspace{14mu}{Droplet}} + A_{{HC}\mspace{14mu}{Droplet}}} \right)}} & (72) \\{S_{A} = {- \left( \frac{{\delta\sigma}_{W - {HC}}}{\delta\; T} \right)_{{Area},P}}} & (73) \\{\sigma_{W - {HC}} = {\sigma_{W - {HC}}^{o}\left( {1 - \frac{T}{\varpi}} \right)}^{n}} & (74) \\{S_{A} = {\frac{\sigma_{W - {HC}}^{o}}{T_{C}}(n)\left( {1 - \frac{T}{\varpi}} \right)^{n - 1}}} & (75) \\{S_{Emulsion} = {\frac{\sigma_{W - {HC}}^{o}}{T_{C}}(n)\left( {1 - \frac{T}{\varpi}} \right)^{n - 1}\left( {\frac{12\;{Yx}_{Water}}{\rho_{Water}d_{d - W}} + \frac{6x_{HC}}{\rho_{HC}d_{d - {HC}}}} \right)}} & (76)\end{matrix}$

Emulsion's reference state entropy is calculated using the sameprinciples used to calculate emulsion's current entropy with area termsreplaced by reference state interfacial area terms outlined in equations69 and 70. Therefore, equations 77 to 79 are used to calculateemulsion's reference state entropy.

$\begin{matrix}{R_{Bit} = {0.001 \times {\exp\left\lbrack \frac{\begin{matrix}{{\left( \frac{\rho_{Emulsion}}{\rho_{Bit}} \right)\left( {\pi\; R_{Pipe}^{2}} \right)\left( {1 - x_{water}} \right)} -} \\{0.609{\ln\left( {10^{3} \times R_{Pipe}} \right)}}\end{matrix}}{1.449} \right\rbrack}}} & (77) \\{A_{{Interface} - {Reference}} = {{2\left\lbrack \frac{\pi\; R_{Pipe}^{2}}{\rho_{Emulsion}} \right\rbrack}\left\lbrack \sqrt{R_{Bit}\left( {{2R_{Pipe}} - R_{Bit}^{2}} \right)} \right\rbrack}} & (78) \\{S_{Reference} = {\frac{\sigma_{W - B}^{o}}{T_{C}}(n)\left( {1 - \frac{T}{\varpi}} \right)^{n - 1}\left( A_{{Interface} - {Reference}} \right)}} & (79)\end{matrix}$

To calculate interfacial Gibbs energy, equations 79, 76, 71, 68, and 65are substituted into equation 62 to generate equations 80 and 81. Sincethe objective is to estimate the fraction of emulsion water present asdroplets (i.e. Y) at wellhead where emulsion is deemed to be atequilibrium, equations 80 and 81 are manipulated into equations 82 and83 by substituting zero for ΔG_(IF) and solving for Y. These twoequations provide an estimate of the mass fraction of emulsion waterpresent as droplets in emulsion's hydrocarbon phase.

$\begin{matrix}{{\Delta\; G_{IF}} = {{\left\lbrack \frac{12\;\sigma_{W - B}x_{Water}}{\rho_{Water}d_{d - W}} \right\rbrack\Upsilon} + {\quad{\left\lbrack \frac{6\sigma_{W - B}x_{B}}{d_{d - B}\rho_{B}} \right\rbrack - {\sigma_{W - B}A_{{Interface} - {Reference}}} - {T{\quad\left( {\frac{n\;\sigma_{W - B}^{o}}{\varpi}\left( {1 - \frac{T}{\varpi}} \right)^{n - 1}\left( {\frac{12\;\Upsilon\; x_{Water}}{\rho_{Water}d_{d - W}} + \frac{6x_{B}}{\rho_{B}d_{d - B}} - A_{{Interface} - {Reference}}} \right)} \right)}}}}}} & (80) \\{\mspace{79mu}{A_{{Interface} - {Reference}} = {{2\left\lbrack \frac{\pi\; R_{Pipe}^{2}}{\rho_{Emulsion}} \right\rbrack}\left\lbrack \sqrt{R_{Bit}\left( {{2R_{Pipe}} - R_{Bit}^{2}} \right)} \right\rbrack}}} & (81) \\{\Upsilon = {\left\{ {{\sigma_{W - B}A_{{Interface} - {Reference}}} - \left\lbrack \frac{6\sigma_{W - B}x_{B}}{d_{d - B}\rho_{B}} \right\rbrack + {\frac{n\;\sigma_{W - B}^{o}T}{\varpi}\left( {1 - \frac{T}{\varpi}} \right)^{n - 1}\left( {\frac{6x_{B}}{\rho_{B}d_{d - B}} - A_{{Interface} - {Reference}}} \right)}} \right\}\left\{ {\left\lbrack \frac{12\sigma_{W - B}x_{Water}}{\rho_{Water}d_{d - W}} \right\rbrack - {T\left( {\frac{n\;\sigma_{W - B}^{o}}{\varpi}\left( {1 - \frac{T}{\varpi}} \right)^{n - 1}\left( \frac{12\Upsilon\; x_{Water}}{\rho_{Water}d_{d - W}} \right)} \right)}} \right\}^{- 1}}} & (82) \\{\mspace{79mu}{A_{{Interface} - {Reference}} = {{2\left\lbrack \frac{\pi\; R_{Pipe}^{2}}{\rho_{Emulsion}} \right\rbrack}\left\lbrack \sqrt{R_{Bit}\left( {{2R_{Pipe}} - R_{Bit}^{2}} \right)} \right\rbrack}}} & (83)\end{matrix}$

In some embodiments, the hydrocarbon phase viscosity is based on theYaron & Gal-Or model and equations 84 to 87. Hydrocarbon phase consistsof hydrocarbon acting as the continuous phase and a fraction ofemulsion's water existing as droplets acting as the dispersed phase.Volumetric fraction of these droplets are calculated using equation 84.

$\begin{matrix}\begin{matrix}{\Gamma = \left( \phi_{Dispersed}^{\frac{1}{3}} \right)} \\{= \left( \frac{V_{Droplet}}{V_{HC} + V_{Droplet}} \right)^{\frac{1}{3}}} \\{= \left( \frac{\frac{\Upsilon\; x_{water}}{\rho_{water}}}{\frac{x_{B} + x_{WCS}}{\rho_{HC}} + \frac{\Upsilon\; x_{water}}{\rho_{water}}} \right)^{\frac{1}{3}}}\end{matrix} & (84) \\{\kappa = {\frac{\mu_{Dispersed}}{\mu_{Continuous}} = \frac{\mu_{Water}}{\mu_{HC}}}} & (85) \\{{I\left( {\Gamma,\kappa} \right)} = \frac{5.5\left\lbrack {{4\Gamma^{7}} + 10 - {7.636\Gamma^{2}} + {4{\kappa^{- 1}\left( {1 - \Gamma^{7}} \right)}}} \right\rbrack}{{10\left( {1 - \Gamma^{10}} \right)} - {25{\Gamma^{3}\left( {1 - \Gamma^{4}} \right)}} + {10{\kappa^{- 1}\left( {1 - \Gamma^{3}} \right)}\left( {1 - \Gamma^{7}} \right)}}} & (86) \\\begin{matrix}{\mu_{{Hydrocarbon}\mspace{14mu}{Phase}} = {\mu_{Continuous}\left\lbrack {1 + {{I\left( {\Gamma,\kappa} \right)}\phi_{Dispersed}}} \right\rbrack}} \\{= {\mu_{HC}\left\lbrack {1 + {{I\left( {\Gamma,\kappa} \right)}\phi_{Dispersed}}} \right\rbrack}}\end{matrix} & (87)\end{matrix}$

In some embodiments, the clean emulsion viscosity is based on the Yaron& Gal-Or model and equations 88 to 91. Overall emulsion consists ofhydrocarbon acting as the dispersed phase and a fraction of emulsion'swater existing as “free water” acting as the continuous phase.Volumetric fraction of hydrocarbon phase is calculated using equation88.

$\begin{matrix}\begin{matrix}{\Gamma = \left( \phi_{Dispersed}^{\frac{1}{3}} \right)} \\{= \left( \frac{V_{Droplet}}{V_{HC} + V_{Droplet}} \right)^{\frac{1}{3}}} \\{= \left( \frac{\frac{\Upsilon\; x_{water}}{\rho_{water}} + \frac{x_{B} + x_{WCS}}{\rho_{HC}}}{\frac{x_{B} + x_{WCS}}{\rho_{HC}} + \frac{x_{water}}{\rho_{water}}} \right)^{\frac{1}{3}}}\end{matrix} & (88) \\{\kappa = {\frac{\mu_{Dispersed}}{\mu_{Continuous}} = \frac{\mu_{Water}}{\mu_{HC}}}} & (89) \\{{I\left( {\Gamma,\kappa} \right)} = \frac{5.5\left\lbrack {{4\Gamma^{7}} + 10 - {7.636\;\Gamma^{2}} + {4{\kappa^{- 1}\left( {1 - \Gamma^{7}} \right)}}} \right\rbrack}{{10\left( {1 - \Gamma^{10}} \right)} - {25{\Gamma^{3}\left( {1 - \Gamma^{4}} \right)}} + {10{\kappa^{- 1}\left( {1 - \Gamma^{3}} \right)}\left( {1 - \Gamma^{7}} \right)}}} & (90) \\\begin{matrix}{\mu_{{Bituman}\mspace{14mu}{Phase}} = {\mu_{Continuous}\left\lbrack {1 + {{I\left( {\Gamma,\kappa} \right)}\phi_{Dispersed}}} \right\rbrack}} \\{= {\mu_{HC}\left\lbrack {1 + {{I\left( {\Gamma,\kappa} \right)}\phi_{Dispersed}}} \right\rbrack}}\end{matrix} & (91)\end{matrix}$

In some embodiments, when the system determines the viscosity of anemulsion contaminated with solids, the system may assume that a solidsparticles present in the emulsion are uniformly distributed within itdue to the high agitation rate imposed on the flow from wellbore towellhead. Under this assumption, emulsion viscosity calculated by theclean emulsion viscosity neuron is adjusted to account for presence ofsolids using the Thomas modification of Einstein's formula for effectiveslurry viscosity as outlined in equations 92 and 93.

$\begin{matrix}{\mu_{emulsion} = {\mu_{{clean}\mspace{14mu}{emulsion}}\begin{bmatrix}{1 + {2.5\;\phi_{solids}} + {10.05\;\phi_{solids}^{2}} +} \\{0.00273{\exp\left( {16.6\phi_{solids}} \right)}}\end{bmatrix}}} & (92) \\\begin{matrix}{\phi_{solids} = \frac{V_{solids}}{V_{Total}}} \\{= \frac{\frac{x_{S}}{\rho_{S}}}{\frac{1}{\rho_{emulsion}}}} \\{= {\frac{\rho_{emulsion}}{2320}x_{S}}}\end{matrix} & (93)\end{matrix}$

In some embodiments, when the system determines the viscosity of anemulsion contaminated with free gas, the system may assume that free gasbubbles are uniformly distributed within the emulsion due to highagitation rate imposed by the emulsion flow. It is also assumed thatemulsion is isothermal from wellhead to choke valve due to the shortdistance between these points and installed heat insulation material.Moreover, as discussed above, emulsion's Capillary Number is low.Therefore, based on all these points, gas bubbles present in emulsionare spherical and so Taylor's formula for calculation of viscosity incolloids with highly deformable dispersed phase, which free gas is, isused to adjust clean emulsion's viscosity for presence of free gas. Thisformula is outlined in equations 94 to 97. Emulsion density iscalculated by the ARC at block 331. Free gas is assumed to consistentirely of steam and hence its viscosity is calculated using theSutherland equation as outlined in equation 98 and 99. WhileSutherland's equation is generally suited for ideal gases, itsapplication to steam is well-known and is with acceptable accuracy. Nopressure term is included in this calculation as gas viscosity is, ingeneral, independent of pressure. Finally, Free gas density iscalculated using equations 48 and 49.

$\begin{matrix}{\mspace{79mu}{\mu_{emulsion} = {\mu_{{clean}\mspace{14mu}{emulsion}}\left( {1 + {f\;\phi_{{free}\mspace{14mu}{gas}}}} \right)}}} & (94) \\{\mspace{79mu}{f = \frac{{5\lambda_{{free}\mspace{14mu}{gas}}} + 2}{2\left( {\lambda_{{free}\mspace{14mu}{gas}} + 1} \right)}}} & (95) \\{\mspace{79mu}{\lambda_{{free}\mspace{14mu}{gas}} = \frac{\mu_{{free}\mspace{14mu}{gas}}}{\mu_{{clean}\mspace{14mu}{emulsion}}}}} & (96) \\\begin{matrix}{\mspace{79mu}{\phi_{{free}\mspace{14mu}{gas}} = \frac{V_{{free}\mspace{14mu}{gas}}}{V_{Total}}}} \\{= \frac{\frac{x_{{free}\mspace{14mu}{gas}}}{\rho_{{free}\mspace{14mu}{gas}}}}{\frac{1}{\rho_{emulsion}}}} \\{= {\frac{\rho_{emulsion}}{\rho_{{free}\mspace{14mu}{gas}}}x_{{free}\mspace{14mu}{gas}}}}\end{matrix} & (97) \\{\mu_{steam} = {\mu_{ref}\frac{T_{ref} + C}{T + C}\left( \frac{T}{T_{ref}} \right)^{1.5}\underset{\rightarrow}{\mu_{ref} = {1.227 \times 10^{05}P\;{a \cdot s}\mspace{14mu}{at}\mspace{14mu} 373\mspace{14mu} K}}}} & (98) \\{\mspace{79mu}{\mu_{steam} = {1.227 \times 10^{- 5}\frac{1334}{T + 961}\left( \frac{T}{373} \right)^{1.5}}}} & (99)\end{matrix}$

At 323, the system generates the emulsion composition. In someembodiments, the system includes 3 outputs (emulsion water, bitumen, andphantom component contents) which can be based on three independent setof equations (composition-density relationship, composition-choke valveperformance relationship, and emulsion mass balance). This means that itcannot necessarily produce an emulsion composition estimation thatsatisfies all of the three independent equation sets. Moreover, allthree independent equation sets rely on potentially noisy and errorladen data which means that none is significantly more accurate than theother. Thus, the sensor has to estimate the emulsion composition usingan approach that treats all equations sets equally and finds an emulsioncomposition estimate that reasonably satisfies all of them.

In some embodiments, the system includes an iterative convergence toolsuch as a processor or other component configured to operate aGauss-Newton process. In some embodiments, to reduce computation timeand/or to enhance the convergence rate of the process, the Gauss-Newtonalgorithm is directly used to estimate emulsion's bitumen and watercontents while emulsion's phantom component (e.g. WCS) content iscalculated using equation 100 which is based on emulsion's mass balance.Minimum WCS content of 0.001 may be chosen to prevent a division by zerofatal error from happening in the Hydrocarbon Phase Viscosity neuron.x _(WCS,i)=Max(1−x _(B,i) −x _(W,i),0.001)  (100)

In some embodiments, the iterative convergence tool proceeds toward theoptimal composition using an iterative process in which the j+1composition estimate is calculated from the j estimate using equation101 which is shown in full details in equation 102. Terms outlined inequation 102 are calculated using equations 103 to 106. Combination ofequations 101 to 106 with each other leads to equations 107 and 108 thatcalculate the j+1 composition estimate from the j one. A damping factorof 0.1 is used in these equations to ensure a smoother convergencetoward the optimal emulsion composition.

$\begin{matrix}{\mspace{79mu}{X_{j + 1}^{\prime} = {X_{j}^{\prime} - {\left( J_{r} \right)^{- 1}{R\left( X_{j}^{\prime} \right)}}}}} & (101) \\{\begin{bmatrix}x_{{bitumen},{j + 1}} \\x_{{water},{j + 1}}\end{bmatrix} = {\begin{bmatrix}x_{{bitumen},j} \\x_{{water},j}\end{bmatrix} - {\frac{1}{{\frac{\delta\; r_{1}}{\delta\; x_{{bitumen},j}}\frac{\delta\; r_{2}}{\delta\; x_{{water},j}}} - {\frac{\delta\; r_{1}}{\delta\; x_{{water},j}}\frac{\delta\; r_{2}}{\delta\; x_{{bitumen},j}}}}{\quad{\begin{bmatrix}\frac{\delta\; r_{2}}{\delta\; x_{{water},j}} & {- \frac{\delta\; r_{1}}{\delta\; x_{{water},j}}} \\{- \frac{\delta\; r_{2}}{\delta\; x_{{bitumen},j}}} & \frac{\delta\; r_{1}}{\delta\; x_{{bitumen},j}}\end{bmatrix}\begin{bmatrix}{r_{1}\left( X_{j} \right)} \\{r_{2}\left( X_{j} \right)}\end{bmatrix}}}}}} & (102) \\{\mspace{79mu}{{r_{1}\left( X_{j} \right)} = {{\rho_{{emulsion}\mspace{14mu}{calculated}}\left( X_{j} \right)} - \rho_{{emulsion}\mspace{14mu}{measured}}}}} & (103) \\{\mspace{79mu}{{r_{2}\left( X_{j} \right)} = {{\mu_{{emulsion}\mspace{14mu}{calculated}}\left( X_{j} \right)} - \mu_{{emulsion}\mspace{14mu}{measured}}}}} & (104) \\{\mspace{79mu}{\frac{\delta_{r_{i}}}{\delta\; x_{{bitumen},j}} = \frac{\begin{matrix}{{r_{i}\left( {{x_{{bitumen},j} + 0.0005},{{Rest}\mspace{14mu}{Constant}}} \right)} -} \\{r_{i}\left( {x_{{bitumen},j},{{Rest}\mspace{14mu}{Constant}}} \right)}\end{matrix}}{0.0005}}} & (105) \\{\mspace{79mu}{\frac{\delta_{r_{i}}}{\delta\; x_{{water},j}} = \frac{\begin{matrix}{{r_{i}\left( {{x_{{water},j} + 0.0005},{{Rest}\mspace{14mu}{Constant}}} \right)} -} \\{r_{i}\left( {x_{{water},j},{{Rest}\mspace{14mu}{Constant}}} \right)}\end{matrix}}{0.0005}}} & (106) \\{x_{{bitumen},{j + 1}} = {x_{{bitumen},j} - {\frac{{\frac{\delta\; r_{2}}{\delta\; x_{{water},j}}r_{1}\left( X_{j} \right)} - {\frac{\delta\; r_{1}}{\delta\; x_{{water},j}}{r_{2}\left( X_{j} \right)}}}{{\frac{\delta\; r_{1}}{\delta\; x_{{bitumen},j}}\frac{\delta\; r_{2}}{\delta\; x_{{water},j}}} - {\frac{\delta\; r_{1}}{\delta\; x_{{water},j}}\frac{\delta\; r_{2}}{\delta\; x_{{bitumen},j}}}} \times {Damping}}}} & (107) \\{x_{{water},{j + 1}} = {x_{{water},j} - {\frac{{\frac{\delta\; r_{2}}{\delta\; x_{{bitumen},j}}r_{1}\left( X_{j} \right)} + {\frac{\delta\; r_{1}}{\delta\; x_{{water},j}}{r_{2}\left( X_{j} \right)}}}{{\frac{\delta\; r_{1}}{\delta\; x_{{bitumen},j}}\frac{\delta\; r_{2}}{\delta\; x_{{water},j}}} - {\frac{\delta\; r_{1}}{\delta\; x_{{water},j}}\frac{\delta\; r_{2}}{\delta\; x_{{bitumen},j}}}} \times {Damping}}}} & (108)\end{matrix}$

For emulsions contaminated with solids, the system can be similarlyconfigured. However, since in this scenario the emulsion compositionsystem is underdefined (four compositional variables and threeindependent equations), it is possible to calculate infinitely manyemulsion compositions that minimize the system error with at least oneof them having a zero overall residual (equation 44). Only a few ofthese many solutions may be valid estimates and these valid estimates donot have to have a zero overall residual. In some instances, manyoptimization algorithms such as the Gauss-Newton algorithm may convergetoward an emulsion composition with the zero residual which may or maynot be a valid solution. Therefore, in some embodiments, the systemincludes a two layered kernel machine to estimate the emulsioncomposition. This kernel's inner layer calculates emulsion's water,solid, and bitumen contents while its outer layer calculates its WCScontent as described herein.

In some instances, the kernel machine may partially circumvent theunder-definition problems through two techniques. First, in someembodiments, the kernel machine is configured to starts the currentcomposition estimation using the previous iterations output (i.e. itparses for the current estimate starting from the old one). This way,its current composition estimate is one that both has a small overallresidual and is close to the previous iteration's output. This applies aweak time based filter to emulsion composition that ensures thatemulsion composition estimates calculated by the kernel machine varygradually as to reflect the emulsion's actual behavior.

Second, in some embodiments, the kernel machine is configured tocircumvents the under-definition problem by dividing the emulsioncomposition exercise into two parts with each part being completelydefined. In some instances, this may reduce the possibility ofcalculation of unfeasible emulsion estimates as under-definition may notbe an issue for the two individual parts.

The kernel machine's inner layer estimates emulsions water, solid, andbitumen contents without changing emulsion's phantom component (e.g.WCS) content using the Gauss-Newton algorithm and the matrix outlined inequation 109. Expansion of this matrix leads to equation 110 to 119 andtable 1. It is critical to note that the inverse of equation 109'sJacobian matrix is calculated using Cramer's rule.

$\begin{matrix}{X_{j + 1}^{\prime} = {X_{j}^{\prime} - {\left( J_{r} \right)^{- 1}{R\left( X_{j}^{\prime} \right)}}}} & (109) \\{\begin{bmatrix}x_{{bitumen},{j + 1}} \\x_{{water},{j + 1}} \\x_{{solids},{j + 1}}\end{bmatrix} = {\begin{bmatrix}x_{{bitumen},j} \\x_{{water},j} \\x_{{solids},j}\end{bmatrix} - {\begin{bmatrix}\Theta_{1} & \Theta_{2} & \Theta_{3} \\\Theta_{4} & \Theta_{5} & \Theta_{6} \\\Theta_{7} & \Theta_{8} & \Theta_{9}\end{bmatrix}\begin{bmatrix}{r_{1}\left( X_{j} \right)} \\{r_{2}\left( X_{j} \right)} \\{r_{3}\left( X_{j} \right)}\end{bmatrix}}}} & (110) \\{{r_{1}\left( X_{j} \right)} = {{\rho_{{emulsion}\mspace{14mu}{calculated}}\left( X_{j} \right)} - \rho_{{emulsion}\mspace{14mu}{measured}}}} & (111) \\{{r_{2}\left( X_{j} \right)} = {{\mu_{{emulsion}\mspace{14mu}{calculated}}\left( X_{j} \right)} - \mu_{{emulsion}\mspace{14mu}{measured}}}} & (112) \\{{r_{3}\left( X_{j} \right)} = {x_{{bitumen},j} + x_{{water},j} + x_{{solids},j} + x_{{WCS},j} - 1}} & (113) \\{\frac{\delta\; r_{i}}{\delta\; x_{{bitumen},j}} = \frac{\begin{matrix}{{r_{i}\left( {{x_{{bitumen},j} + 0.0005},{{Rest}\mspace{14mu}{Constant}}} \right)} -} \\{r_{i}\left( {x_{{bitumen},j},{{Rest}\mspace{14mu}{Constant}}} \right)}\end{matrix}}{0.0005}} & (114) \\{\frac{\delta\; r_{1}}{\delta\; x_{{water},j}} = \frac{\begin{matrix}{{r_{i}\left( {{x_{{water},j} + 0.0005},{{Rest}\mspace{14mu}{Constant}}} \right)} -} \\{r_{i}\left( {x_{{water},j},{{Rest}\mspace{14mu}{Constant}}} \right)}\end{matrix}}{0.0005}} & (115) \\{\frac{\delta\; r_{1}}{\delta\; x_{{solids},j}} = \frac{\begin{matrix}{{r_{i}\left( {{x_{{solids},j} + 0.0005},{{Rest}\mspace{14mu}{Constant}}} \right)} -} \\{r_{i}\left( {x_{{solids},j},{{Rest}\mspace{14mu}{Constant}}} \right)}\end{matrix}}{0.0005}} & (116) \\{x_{{bitumen},{j + 1}} = {x_{{bitumen},j} - \left\lbrack {{\Theta_{1}{r_{1}\left( X_{j} \right)}} + {\Theta_{2}{r_{2}\left( X_{j} \right)}} + {\Theta_{3}{r_{3}\left( X_{j} \right)}}} \right\rbrack}} & (117) \\{x_{{water},{j + 1}} = {x_{{water},j} - \left\lbrack {{\Theta_{4}{r_{1}\left( X_{j} \right)}} + {\Theta_{5}{r_{2}\left( X_{j} \right)}} + {\Theta_{6}{r_{3}\left( X_{j} \right)}}} \right\rbrack}} & (118) \\{x_{{solids},{j + 1}} = {x_{{solids},j} - \left\lbrack {{\Theta_{7}{r_{1}\left( X_{j} \right)}} + {\Theta_{8}{r_{2}\left( X_{j} \right)}} + {\Theta_{9}{r_{3}\left( X_{j} \right)}}} \right\rbrack}} & (119)\end{matrix}$

TABLE 1 Equation 110 Inverse Jacobian Matrix Terms Term Formula χ$\quad\begin{matrix}{{\frac{\delta\; r_{1}}{\delta\; x_{B}}\left( {{\frac{\delta\; r_{2}}{\delta\; x_{W}}\frac{\delta\; r_{3}}{\delta\; x_{s}}} - {\frac{\delta\; r_{2}}{\delta\; x_{s}}\frac{\delta\; r_{3}}{\delta\; x_{W}}}} \right)} - {\frac{\delta\; r_{1}}{\delta\; x_{W}}\left( {{\frac{\delta\; r_{2}}{\delta\; x_{B}}\frac{\delta\; r_{3}}{\delta\; x_{S}}} - {\frac{\delta\; r_{2}}{\delta\; x_{S}}\frac{\delta\; r_{3}}{\delta\; x_{B}}}} \right)} +} \\{\frac{\delta\; r_{1}}{\delta\; x_{S}}\left( {{\frac{\delta\; r_{2}}{\delta\; x_{B}}\frac{\delta\; r_{3}}{\delta\; x_{W}}} - {\frac{\delta\; r_{3}}{\delta\; x_{B}}\frac{\delta\; r_{2}}{\delta\; x_{W}}}} \right)}\end{matrix}$ Θ₁$\left( {{\frac{\delta\; r_{2}}{\delta\; x_{W}}\frac{\delta\; r_{3}}{\delta\; x_{S}}} - {\frac{\delta\; r_{3}}{\delta\; x_{W}}\frac{\delta\; r_{2}}{\delta\; x_{S}}}} \right)\chi^{- 1}$Θ₂${- \left( {{\frac{\delta\; r_{2}}{\delta\; x_{B}}\frac{\delta\; r_{3}}{\delta\; x_{S}}} - {\frac{\delta\; r_{2}}{\delta\; x_{S}}\frac{\delta\; r_{3}}{\delta\; x_{B}}}} \right)}\chi^{- 1}$Θ₃$\left( {{\frac{\delta\; r_{2}}{\delta\; x_{B}}\frac{\delta\; r_{3}}{\delta\; x_{W}}} - {\frac{\delta\; r_{2}}{\delta\; x_{W}}\frac{\delta\; r_{3}}{\delta\; x_{B}}}} \right)\chi^{- 1}$Θ₄${- \left( {{\frac{\delta\; r_{1}}{\delta\; x_{W}}\frac{\delta\; r_{3}}{\delta\; x_{S}}} - {\frac{\delta\; r_{1}}{\delta\; x_{S}}\frac{\delta\; r_{3}}{\delta\; x_{W}}}} \right)}\chi^{- 1}$Θ₅$\left( {{\frac{\delta\; r_{1}}{\delta\; x_{B}}\frac{\delta\; r_{3}}{\delta\; x_{S}}} - {\frac{\delta\; r_{1}}{\delta\; x_{S}}\frac{\delta\; r_{3}}{\delta\; x_{B}}}} \right)\chi^{- 1}$Θ₆${- \left( {{\frac{\delta\; r_{1}}{\delta\; x_{B}}\frac{\delta\; r_{3}}{\delta\; x_{W}}} - {\frac{\delta\; r_{1}}{\delta\; x_{W}}\frac{\delta\; r_{3}}{\delta\; x_{B}}}} \right)}\chi^{- 1}$Θ₇$\left( {{\frac{\delta\; r_{1}}{\delta\; x_{W}}\frac{\delta\; r_{2}}{\delta\; x_{S}}} - {\frac{\delta\; r_{1}}{\delta\; x_{S}}\frac{\delta\; r_{2}}{\delta\; x_{W}}}} \right)\chi^{- 1}$Θ₈${- \left( {{\frac{\delta\; r_{1}}{\delta\; x_{B}}\frac{\delta\; r_{2}}{\delta\; x_{S}}} - {\frac{\delta\; r_{1}}{\delta\; x_{S}}\frac{\delta\; r_{2}}{\delta\; x_{B}}}} \right)}\chi^{- 1}$Θ₉$\left( {{\frac{\delta\; r_{1}}{\delta\; x_{B}}\frac{\delta\; r_{2}}{\delta\; x_{W}}} - {\frac{\delta\; r_{1}}{\delta\; x_{W}}\frac{\delta\; r_{2}}{\delta\; x_{B}}}} \right)\chi^{- 1}$

The kernel machine's outer layer calculates an emulsion's phantomcomponent (WCS) content by slightly adjusting emulsion's the non-WCScompositional estimates. However, to ensure machine stability, outerkernel does not adjust the relative ratio of non-WCS compounds' massfractions with respect to each other. This machine estimates theemulsion's WCS content by attempting to minimize the residual functionoutlined in equation 120. This residual function is based on the factthe WCS is a phantom component, is used to adjust bitumen parameters forvariations between reservoirs and between different times in areservoir, and does not actually exist in the system. Therefore, in someembodiments, the emulsion's estimated WCS content is minimized to reducethe impact of this phantom component on the emulsion compositionestimate. However, this minimization should not be done at the cost ofimparting larger errors in the calculation of the emulsion compositionestimate. Hence, minimizing equation 120 should provide a suitabletrade-off between error imparted by having large WCS estimates anderrors imparted by having unreasonably small WCS estimates. In someembodiments, the system may impose a maximum value for WCS as valuesabout this maximum may represent unrealistic or unreliable results.r ₄(X _(j))=|r ₁(X _(j))|+|r ₂(X _(j))|+|r ₃(X _(j))|+|x _(WCS)|  (120)

In some embodiments, the kernel machine includes an iterativeconvergence tool for iteratively calculating the estimated producedfluid composition. In some embodiments, the kernel machine applies aGauss-Newton algorithm. Iterative functions used to calculate emulsion'sphantom component and non-phantom component contents are outlined inequation 121 & 122 and 123 respectively. Equation 123 is obtained bycombining the fact that emulsion composition must always add up to onewith the requirement that the outer kernel does not adjust the relativeratio of non-phantom component compounds' mass fractions with respect toeach other.

$\begin{matrix}{x_{{WCS},{j + 1}} = {x_{{WCS},j} - \frac{r_{4}\left( X_{j} \right)}{\frac{\delta\;{r_{4}\left( X_{j} \right)}}{\delta\; x_{WCS}}}}} & (121) \\{\frac{\delta\; r_{4}}{\delta\; x_{{WCS},j}} = \frac{\begin{matrix}{{r_{4}\left( {{x_{{WCS},j} + 0.0005},{{Rest}\mspace{14mu}{Constant}}} \right)} -} \\{r_{4}\left( {x_{{WCS},j},{{Rest}\mspace{14mu}{Constant}}} \right)}\end{matrix}}{0.0005}} & (122) \\{x_{{{All}\mspace{14mu}{Excluding}\mspace{14mu}{WCS}},{j + 1}} = {x_{{{All}\mspace{11mu}{Excluding}\mspace{14mu}{WCS}},j} \times \frac{1 - x_{{WCS},{j + 1}}}{1 - x_{{WCS},j}}}} & (123)\end{matrix}$

In some embodiments, the same or similar process for generating thecomposition of emulsion contaminated with solids is used to estimate thecomposition of emulsion contaminated with free gas. i.e. the processoutlined above is adjusted with all solids related terms replaced withfree gas terms.

In some embodiments, the produced fluid composition generator includes aneural network. The neural network includes a selector that receives aproduced fluid contaminant (e.g. gas/solid/no-contaminant) signal fromthe emulsion density ARC and only awakens the neuron(s) corresponding tothe ARC signal. In some embodiments, three neurons/neuron sets/branchesembedded in the neural network each determine the composition of a cleanemulsion (i.e. an emulsion with no free gas or solids), an emulsioncontaminated with free gas, and an emulsion contaminated with solidsusing the emulsion composition node's data and computations describedabove. FIG. 14 shows aspects of an example neural network including thethree neural network branches which may be selected by the producedfluid contaminant signal.

Wellheads often have Coriolis density meters that are capable ofproviding estimates of emulsion density. However, these meters are notcalibrated on a PM basis as they are not MARP (Measurement, Accounting,and Reporting Plan) meters. Thus, their readings may not be accurate.

With respect to block 331, in some embodiments, the system includes anadvanced regulatory control (ARC) system which, in some instances, cancheck for presence of contaminants in the emulsion and/or minimizesinvalid soft sensor outputs.

FIG. 16 shows a data flow diagram showing aspects of an example ARCsystem. In some embodiments, the ARC system includes a backup densitycalculator. In some instances, the backup density calculator isconfigured based on the fact that a pump's head is independent of thedensity the fluid that it is pumping. In some embodiments, thecalculator generates the ESP's head, and the emulsion's pressure at theESP discharge; and combines this data to generate a backup emulsiondensity.

In some embodiments, ESP head can be calculated using equations 124 to126. These equations, sometimes referred to as the Walshaw-Jobsoncorrelation system, relate the pump impeller speed, head, and flow rate.λ₀, λ₁, and λ₂ are obtained by fitting the Walshaw-Jobson system intothe ESP's pump curve and the rest of variables are obtained from theirrespective DCS data streams. The original form of this system includesterms to include impeller diameter in the pump performance relationshipmatrix. However, these terms are left out as impeller diameter does notchange during the course of operation of an ESP and thus its effect onthe pump head-speed-flow matrix can easily be captured by λ₀, λ₁, andλ₂.

$\begin{matrix}{C_{H} = \frac{{gH}_{ESP}}{\omega^{2}}} & (124) \\{C_{F} = \frac{F}{\omega}} & (125) \\{C_{H} = {\lambda_{0} + {\lambda_{1}C_{F}} + {\lambda_{2}C_{F}^{2}}}} & (126)\end{matrix}$

Emulsion pressure at pump discharge is calculated by adding the staticpressure differential between ESP discharge and wellhead pressuretransmitter and frictional pressure drop in the production string towellhead pressure reading as outlined in equation 127. Emulsionfrictional losses between ESP and wellhead are calculated using theDarcy-Weisbach formula outlined in equation 130. Substituting therelationship between emulsion velocity and flow rate into equation 129has led to this equation. Darcy friction factor of 0.026 is used perMoody's diagram and the production string characteristics. Substitutingthis equation into equation 127 leads to equation 128.

$\begin{matrix}{\mspace{79mu}{p_{discharge} = {p_{wellhead} + {\rho_{emulsion}{gz}_{{ESP} - {TVD}}} + {\Delta\; p}}}} & (127) \\{p_{discharge} = {p_{wellhead} + {\rho_{emulsion}{gz}_{{ESP} - {TVD}}} + {\left( \frac{0.208\; L_{{ESP} - {MD}}}{\pi^{2}D_{{Prod}.{Str}.}^{5}} \right)\rho_{Emulsion}F_{E}^{2}}}} & (128) \\{\mspace{79mu}{{\Delta\; p} = {f_{d} \cdot \frac{L_{{ESP} - {MD}}}{D_{{Prod}.{Str}.}} \cdot \frac{\rho_{Emulsion}v_{E}^{2}}{2}}}} & (129) \\{\mspace{79mu}{{\Delta\; p} = {\left( \frac{0.208\; L_{{ESP} - {MD}}}{\pi^{2}D_{{Prod}.{Str}.}^{5}} \right)\rho_{Emulsion}F_{E}^{2}}}} & (130)\end{matrix}$

ESP head relation with emulsion's pressure differential across the ESPis outlined in equation 131. Discharge pressure calculation approach isoutlined in previous parts of this section and emulsion pressure at ESPsuction is calculated as described below. Substitution of equation 128into this equation leads to equation 132. This equation can easily besolved to obtain a function explicit in terms of emulsion density.Nevertheless, an alternate approach is taken in which the latestcalculated optimal emulsion density (or Coriolis meter reading if one isnot available) is used for bolded emulsion terms. This approach is takento convert the backup emulsion density calculation formula from one thatsatisfies the Markov property to one that resembles a Wiener process.This ensures that backup emulsion density is adequately filtered whilenot being overwhelmed by previous density estimates.

$\begin{matrix}{\mspace{79mu}{{\rho_{Emulsion}{gH}_{ESP}} = {p_{discharge} - p_{suction}}}} & (131) \\{\rho_{emulsion} = {\begin{bmatrix}{p_{wellhead} + {\rho_{emulsion}{gz}_{{ESP} - {TVD}}} +} \\{{\left( \frac{0.208\; L_{{ESP} - {MD}}}{\pi^{2}D_{{Prod}.{Str}.}^{5}} \right)\rho_{Emulsion}F_{E}^{2}} - p_{suction}}\end{bmatrix}\left\lbrack {gH}_{ESP} \right\rbrack}^{- 1}} & (132)\end{matrix}$

The suction pressure ARC uses the criterion outlined in equation 133along with the latest optimal emulsion density estimate (or Coriolismeter reading if one is not available) to determine if a projected ESPsuction pressure is valid or not. Essentially, this criterion is a checkof whether the sum of ESP head and projected ESP suction pressure minusthe expected static and frictional pressure drops between ESP andwellhead are close to the wellhead emulsion pressure, which they shouldbe, or not. Projected ESP suction pressure sources are outlined in table2 in order of their priority with ARC ruling out a higher ranked datasource before moving to a lower ranked one.

$\begin{matrix}{{{p_{ESPSuction} + {\rho_{Emulsion}{gH}_{ESP}} - {\rho_{Emulsion}{gz}_{{ESP} - {TVD}}} - {\left( \frac{0.208\; L_{{ESP} - {MD}}}{\pi^{2}D_{{Prod}.{Str}.}^{5}} \right)\rho_{Emulsion}F_{E}^{2}} - p_{wellhead}}} \leq {100\mspace{14mu}{kPa}}} & (133)\end{matrix}$

TABLE 2 ESP Suction Pressure Data Sources Rank Source Source Notes 1Producer P_(heel) Heel 2 Producer Toe $\quad\begin{matrix}{p_{toe} -} \\{{\left( \frac{0.208\left\lbrack {L_{{toe} - {MD}} - L_{{ESP} - {MD}}} \right\rbrack}{\pi^{2}D_{Producer}^{5}} \right)\rho_{Emulsion}F_{E}^{2}} -} \\{{{Corr}.\mspace{14mu}{Factor}} \times \left( {z_{{Toe} - {TVD}} - z_{{ESP} - {TVD}}} \right)}\end{matrix}$ Use scab liner diameter as producer well diameter if oneis installed. Otherwise, use slotted liner diameter. Second correctionterm is obtained from MI3. 3 Injector p_(Injector heel) Heel

In some embodiments, the ARC includes a multi-objective selector. Thisselector checks whether wellhead Coriolis meter's emulsion densityreadings are in-between water and bitumen reference densities at processconditions. If they are not, selector replaces them with backup emulsiondensity readings only if backup emulsion density readings satisfy thiscriterion. If neither of emulsion density readings fulfill the validitycriterion, a “solids” message is transmitted to the soft sensor ifCoriolis meter density readings are larger than both referencedensities. Otherwise, a “gas” message is transmitted if Coriolis meterdensity readings are smaller than both reference densities. Coriolismeter readings are not replaced with backup emulsion density estimationsin these scenarios.

As described above, in some embodiments, the system includes a producedfluid perceptron (block 341). In some instances, the produced fluid'sdispersed phase can constitute hydrocarbon or water phases that canimpact the emulsion viscosity. If the selector selecting the wrongdispersed phase, the accuracy of estimated bitumen composition may beimpacted. In some embodiments, the system is configured to generate theemulsion composition twice: once treating the hydrocarbon phase as theemulsion's dispersed phase and the other doing the opposite. With thesecomposition outputs, the system determines which output is a validemulsion composition, and the other output is discarded. In someinstances, this may be computationally expensive to perform.

In another embodiment, the systems includes a machine learning system topredictively select the dispersed phase to reduce the computationrequirements. In some embodiments, a Bayesian Perceptron is used tominimize the impact of wrong dispersed phase selection on DCScalculation load. The perceptron can include two parts: a first partperforming on-spot QA/QC of emulsion data, and a second part using theQA/QC performance results to minimize the number of wrong dispersedphase selections. An overview of this system is provided in FIG. 17.

In some embodiments, the dispersed phase selection matrix is configuredto optimize the selection of dispersed phase and minimize the number ofwrong selections and resultant calculations. This matrix's setup isoutlined in equation 134 and, in an example embodiments, it can beformatted as follows:

-   -   It covers viscosity measurements between 0 Pa·S and 100 Pa·S        with rows 1 to 30 having 0.0002 intervals covering the overall        viscosity range of 0 to 0.006 and row 31 having a 99.994 Pa·S        interval covering a range covering the viscosity range of 0.006        Pa·S to 100 Pa·S.    -   # of Water Successes in each row is defined as the number of        valid emulsion composition estimates that have been obtained by        treating water as the emulsion's dispersed phase for wellhead        emulsions with viscosities falling in that row's range.    -   # of Hydrocarbon Successes in each row is defined as the number        of valid emulsion composition estimates that have been obtained        by treating hydrocarbon as the emulsion's dispersed phase for        wellhead emulsions with viscosities falling in that row's range.    -   # of Total Failures in each row is defined as the number of        times that a “Bad Value” error has been returned by the        Perceptron for wellhead emulsions with viscosities falling in        that row's range.    -   This matrix is filled on the basis of a 30 day rolling database.        i.e. the oldest entry used to fill out is 30 days old with new        entries replacing old ones a continuous basis.

$\begin{matrix}{{{Dispersed}\mspace{14mu}{Phase}\mspace{14mu}{Selection}\mspace{14mu}{Matrix}} \equiv {\quad\begin{bmatrix}\begin{matrix}{{Low}\mspace{14mu}{Viscosity}} \\{{Level}\mspace{14mu}\left( {{Pa}.s} \right)}\end{matrix} & \begin{matrix}{{High}\mspace{14mu}{Viscosity}} \\{{Level}\mspace{14mu}\left( {{Pa}.s} \right)}\end{matrix} & \begin{matrix}{\#\mspace{14mu}{of}\mspace{14mu}{Water}} \\{Successes}\end{matrix} & \begin{matrix}{\#\mspace{14mu}{of}\mspace{14mu}{Hydrocarbon}} \\{Successes}\end{matrix} & \begin{matrix}{\#\mspace{14mu}{of}\mspace{14mu}{Total}} \\{Failures}\end{matrix} \\0 & {{Low} + 0.0002} & \# & \# & \# \\{{{Previous}\mspace{14mu}{Low}} + 0.0002} & {{Low} + 0.0002} & \# & \# & \# \\0.006 & 100 & \# & \# & \#\end{bmatrix}}} & (134)\end{matrix}$

In some embodiments, the Perceptron both selects the dispersed phase andperforms QA/QC on estimated emulsion composition data. Perceptronperforms the first task by using the matrix described above andemulsion's measured viscosity to identify the emulsion's most probabledispersed phase. More specifically, perceptron matches emulsion'smeasured viscosity with one of the rows of this matrix and reportseither of water of hydrocarbon that has the highest number of successfulemulsion composition estimates as the emulsion's dispersed phase. Thisis done after calculation of emulsion's measured viscosity and beforethe start of the GN algorithm. Perceptron performs the second tasks byapplying conditions outlined in FIG. 16 to data and either re-runningthe neural network with a new dispersed phase, accepting the calculatedemulsion composition as a valid output or deeming the system insolvableif no valid emulsion composition estimate has been calculated fromtreatment of either of water or hydrocarbon as the emulsion's dispersedphases. In all these scenarios, Perceptron also updates the dispersedphase selection matrix using its decision-making's outcome andemulsion's viscosity.

FIG. 18 shows aspects of an example neural network 1800 which can beused to sense or otherwise detect the composition of a produced fluidbeing conducted from a reservoir. In some embodiments, the nodes of theneural network correspond to the example process blocks illustrated inFIG. 3. In some embodiments, the input layer of the neural networkincludes a well's Electrical Submersible Pump (ESP) rotor speed; aninjector well heel pressure; producer well heel and toe pressures;wellhead emulsion temperature; wellhead emulsion pressure; wellheademulsion group separator pressure; wellhead emulsion flowrate; andwellhead emulsion choke valve stem travel.

In some embodiments, the output layer includes: wellhead emulsioncomposition (i.e. its water and bitumen concentrations); the neuralnetwork calculated density and viscosity combined error residual (i.e.its root mean residual); and an indication of whether water or oilconstitutes the emulsion's dominant dispersed phase.

In some instances, neural networks may require significant computingpower to produce accurate and high quality estimations. In somesituations, limited computing resources may be available at a productionlocation or in a process control system. In some embodiments, the neuralnetwork processes illustrated in FIG. 3 may be implemented as a gray-boxneural network. In some instances, gray-box neural networks can includea combination of black-box neurons (i.e. statistical-only, small-scalemathematical models) and white-box neurons (i.e. small-scalemathematical models developed based on scientific relations betweentheir inputs and outputs). In some instances, these neural networks mayrequire significant computational resources during the training process.

In some embodiments, to reduce the training resource requirements, theneural network's training may be localized in the “Emulsion CompositionQA/QC” Perceptron as described herein (block 341). In some embodiments,the perceptron can be trained by developing a matrix of all ofemulsion's dominant dispersed phases (i.e. one of the network's outputs)vs. all of viscosities calculated by the neuron as described withrespect to block 318. With this approach, the training process can besimplified by focussing on the emulsion's dominant dispersed phase asthe most weighted unknown variable in the neural network.

In some embodiments, the neural network can require less training byreducing accuracy for extreme cases which may not be fully modelled inthe white-box neurons' core algorithms.

In some instances, since a large part of the neural network is based onwhite-box neurons means, it may requires less training than atraditional black-box neural network. In some embodiments, much of thetraining process can be localized at the “Emulsion Composition QA/QC”Perceptron. In some embodiments, this perceptron is trained dynamicallyusing a recursive matrix which is filled by the network's output andpart of its intermediate calculations as it processes additional data.

In some embodiments, the neural network 1800 can be represented as anetwork of approximately four layers. It should be noted that since thenetwork is a combination of recurrent and feedforward networks, theneurons do not necessarily fall into distinct layers.

In some instances, true error can be calculated as a combination ofmeter measurement error, training error and model optimism. In someinstances, preliminary results have shown that some embodiments of thesystems and methods described herein generate outputs which are within5% of water cut meter readings. Based on an approximate 5% measurementerror in the industrial input devices, the true error can, in somescenarios, be estimated to be 10%.

In some instances, the methods and systems described herein may providea reasonable alternative to current measurement and monitoring systems.In some embodiments, the methods and systems described herein mayprovide a backup system which may verify and/or monitor the outputsand/or the proper functioning of meters (such as water cut meters) inthe system.

Although the embodiments have been described in detail, it should beunderstood that various changes, substitutions and alterations can bemade herein without departing from the scope as defined by the appendedclaims.

Moreover, the scope of the present application is not intended to belimited to the particular embodiments of the process, machine,manufacture, composition of matter, means, methods and steps describedin the specification. As one of ordinary skill in the art will readilyappreciate from the disclosure of the present invention, processes,machines, manufacture, compositions of matter, means, methods, or steps,presently existing or later to be developed, that perform substantiallythe same function or achieve substantially the same result as thecorresponding embodiments described herein may be utilized. Accordingly,the appended claims are intended to include within their scope suchprocesses, machines, manufacture, compositions of matter, means,methods, or steps.

As can be understood, the examples described above and illustrated areintended to be exemplary only. The scope is indicated by the appendedclaims.

The following table provides definitions for select symbols andabbreviations.

Symbol Description Units A_(Droplet) Emulsion Droplet Surface Area m²A_(HC) _(Droplet) Emulsion Hydrocarbon Droplets' Surface Area m²A_(Interface-Reference) Emulsion Reference State Hydrocarbon-Water m²Interface Area A_(Water Droplet) Emulsion Water Droplets' Surface Aream² A_(o) Regression Coefficient — A₁ Regression Coefficient — A₂Regression Coefficient — ARC Advanced Regulatory Control — B_(o)Microsoft Excel Regression Coefficient — B₁ Microsoft Excel RegressionCoefficient — C₁ Droplet Diameter Calculation Constant — C₂ DropletDiameter Calculation Constant — C_(v) Flow Coefficient USGPM.PSI^(−0.5)C_(v) (Expected) Expected Flow Coefficient USGPM.PSI^(−0.5) CNNConvoluted Neural Network — d_(D) Emulsion Droplet Diameter m d_(d-w)Emulsion Water Droplet Diameter m DCS Distributed Control Systems — DNNDeep Neural Network — ESP Electrical Submergible Pump — F Flow Rate m³/sF_(V) Choke Valve Flow Coefficient Correction Factor — GN Gauss-Newton —g Gravity Constant m/s² I (Γ, κ) Yaron & Gal-Or Viscosity Model EmulsionViscosity — Correction Factor i Complex Number {square root over (−1)} —J_(r) Gauss-Newton Algorithm Jacobean Matrix — M_(HC) Hydrocarbon PhaseMolar Mass kg/mol M_(w) Water Molar Mass kg/mol MARP Measurement,Recording, and Accounting Plan — NN Neural Networks — N_(R) WellheadEmulsion Choke Valve Reynolds Number — n Regression Coefficient — PPressure Pa P_(ESP) _(Discharge) ESP Discharge Pressure Pa PM PreventiveMaintenance — Q Flow Rate m³/hr QA Quality Control — QC QualityAssurance — R (X′_(j)) Gauss-Newton Algorithm Residual Vector (j —algorithm) R_(Casing) Producer Well Casing Radius m R_(HC) EmulsionReference State Hydrocarbon Layer m Depth R_(Production String)Production String Radius m R² Coefficient of Determination — r_(t)(X_(j+1)) Gauss-Newton Algorithm Root Mean Residual — r₁ (X_(j))Gauss-Newton Algorithm Emulsion Density kg/m³ Residual r₂ (X_(j))Gauss-Newton Algorithm Emulsion Viscosity Pa · s Residual r₃ (X_(j))Gauss-Newton Algorithm Emulsion Composition Pa · s Residual r₄ (X_(j))Gauss-Newton Algorithm Emulsion WCS Content Pa ·s Residual S_(A)Emulsion Interfacial Entropy per Unit Area J/m² S_(Emulsion) EmulsionInterfacial Entropy J/K S_(Reference) Emulsion Reference StateInterfacial Entropy J/K SAGD Steam Assisted Gravity Drainage — TTemperature K V_(Droplet) Emulsion Droplet Volume m³ V_(Eff) EnergyDissipation Effective Volume m³ V_(HC) Hydrocarbon Molar Volume m³/kgV_(Total) Emulsion Total Volume m³ V_(W) Water Molar Volume m³/kg VBNRefutas Method Viscosity Blend Number — VBN_(B) Refutas Method BitumenViscosity Blend Number — VBN_(HC) Refutas Method Hydrocarbon PhaseViscosity — Blend Number VBN_(WCS) Refutas Method WCS Viscosity BlendNumber — W_(HC) _(Droplet-Final) Emulsion Hydrocarbon DropletInterfacial Enthalpy J W_(Reference) Emulsion Reference StateInterfacial Enthalpy J W_(Water Droplet-Final) Emulsion Water DropletInterfacial Enthalpy J WCS Western Canadian Select — X′_(j+1) EmulsionComposition Vector (j + 1 iteration) — x Microsoft Excel RegressionTable Independent — Variable x_(bitumen) & x_(B) Emulsion BitumenContent Mass Frac. x_(bitumen, j) j^(th) iteration emulsion bitumencontent estimate Mass Frac. x_(gas) Emulsion Free Gas x_(S) Emulsionsolids content Mass Frac. x_(water) & x_(W) Emulsion Water Content MassFrac. x_(water, j) j^(th) iteration emulsion water content estimate MassFrac. x_(WCS) Emulsion Western Canadian Select Content — y MicrosoftExcel Regression Table Dependent — Variable z_(ESP-TVD) ESP TrueVertical Depth m Γ Yaron & Gal-Or Viscosity Model Volume Fraction —Parameter ΔG_(IF) Emulsion Interfacial Gibbs Free Energy Change J ΔSEmulsion Interfacial Entropy Change J/K ΔW_(Water Droplet) EmulsionInterfacial Water Droplet Enthalpy Change J ΔW_(HC Droplet) EmulsionInterfacial Hydrocarbon Droplet Enthalpy J Change ε Turbulent FlowEnergy Dissipation Rate m²/s³ κ Yaron & Gal-Or Viscosity Model Viscosity— Parameter μ Dynamic Viscosity Pa · s μ_(B) Bitumen Dynamic ViscosityPa · S μ_(Continuous) Emulsion Continuous Phase Viscosity Pa · sμ_(Dispersed) Emulsion Dispersed Phase Viscosity Pa · sμ_(emulsion calculated) (X_(j)) Emulsion Viscosity calculated fromj^(th) iteration's Pa · s emulsion composition vector —μ_(emulsion measured) Measured Emulsion Viscosity Pa.s μ_(W) WaterDynamic Viscosity Pa.s ν Kinematic Viscosity — ν_(HC) Hydrocarbon PhaseKinematic Viscosity —

Regression Coefficient — ρ Density kg/m³ ρ_(bitumen) Reference BitumenDensity kg/m³ ρ_(emulsion) Emulsion Density kg/m³ρ_(emulsion calculated) (X_(j)) Emulsion Density calculated from j^(th)iteration's kg/m³ emulsion composition vector ρ_(Continuous) EmulsionContinuous Phase Density kg/m³ ρ_(emulsion measured) Measured EmulsionDensity kg/m³ ρ_(HC) Hydrocarbon Phase Density kg/m³ ρ_(gas) EmulsionFree Gas Density kg/m³ ρ_(S) Emulsion Solids Reference Density kg/m³ρ_(water) Reference Water Density kg/m³ σ_(HC) Hydrocarbon SurfaceTension J/m² σ_(W) Water Surface Tension J/m² σ_(W-B) Water-BitumenInterfacial Tension J/m² σ_(W-HC) ^(o) Regression Coefficient —

Viscoelastic Emulsion Dynamic Viscosity — Calculation Parameter τ SteamDensity Calculation Intermediate Factor — γ Mass Fraction of EmulsionWater Existing as Mass Frac. Droplets Suspended in Hydrocarbon Phaseϕ_(x) Volumetric Fraction of x in Emulsion Vol. Frac. ϕ_(Dispersed)Emulsion Dispersed Phase Volumetric Fraction Vol. Frac. ϕ₀ RegressionCoefficient — ϕ₁ Regression Coefficient — ϕ₂ Regression Coefficient — ϕ₃Regression Coefficient — Ψ Viscoelastic Emulsion Dynamic Viscosity —Calculation Parameter Ω Surface Tension Volume Factor m/mol^(1/3)

What is claimed is:
 1. A system for sensing an estimated composition ofa produced fluid being conducted from a reservoir, the systemcomprising: at least one device for measuring temperature data for theproduced fluid; at least one device for obtaining flow rate data,pressure data, pump speed data and valve travel data for the producedfluid being conducted from the reservoir; at least one memory device forstoring obtained and historical data; a first produced fluid densitygenerator configured to: generate a first produced fluid density basedat least in part on the obtained flow rate data, pressure data, and pumpspeed data for the produced fluid being conducted from the reservoir; asecond produced fluid density generator configured to: generate a secondproduced fluid density based at least in part on a bitumen referencedensity corresponding to the measured temperature data, a waterreference density corresponding to the measured temperature data, and aphantom component reference density corresponding to the measuredtemperature data; and a composition generator configured to: generate,with an iterative convergence tool, a phantom component content, abitumen content and a water content for the produced fluid based on atleast in part on: a material balance of the produced fluid and adifference between the first produced fluid density and the secondproduced fluid density; and generate outputs representing the phantomcomponent content, the bitumen content and the water content.
 2. Thesystem of claim 1 comprising an alert generator configured to generatean alert signal when the water content meets a trigger condition.
 3. Thesystem of claim 1 comprising a water cut meter for measuring a water cutof the produced fluid being conducted from the reservoir; and a metermonitor configured to: compare the water cut with the phantom componentcontent, the bitumen content and the water content; and generate alertsignals when the comparison identifies a discrepancy between the watercut and the phantom component content, the bitumen content and the watercontent.
 4. The system of claim 1, wherein the first produced fluiddensity generator is configured to generate a produced fluid contaminantindicator signal based on the first produced fluid density, a bitumenreference density corresponding to the measured temperature data and awater reference density corresponding to the measured temperature data;and wherein the second produced fluid density generator comprises aneural network configured to generate the second produced fluid densitybased in part on a neuron selected by the produced fluid contaminantindicator signal.
 5. The system of claim 4, wherein the compositiongenerator comprises a neural network configured to generate the phantomcomponent content, the bitumen content and the water content based onthe produced fluid contaminant indicator signal.
 6. The system of claim4, comprising an alert generator configured to generate an alert signalwhen the produced fluid contaminant indicator signal indicates that atleast one of solids or gas is present the produced fluid.
 7. The systemof claim 1 comprising at least one device for measuring a produced fluiddensity; wherein generating the first produced fluid density comprises:generating a backup produced fluid density based at least in part on theobtained flow rate data, pressure data, and pump speed data; andselecting the measured produced fluid density as the first producedfluid density when the measured produced fluid density is within adensity range between the water reference density corresponding to themeasured temperature data and the bitumen reference densitycorresponding to the measured temperature data, or selecting the backupproduced fluid density as the first produced fluid density when themeasured produced fluid density is not within the density range.
 8. Thesystem of claim 1, wherein the iterative convergence tool adjusts thephantom component content until the material balance of the producedfluid and the difference between the first produced fluid density andthe second produced fluid density converge.
 9. The system of claim 1,comprising: at least one device for obtaining valve travel data for theproduced fluid; a first produced fluid viscosity generator configuredto: generate a first produced fluid viscosity based at least in part on:the bitumen reference density and a bitumen reference viscositycorresponding to the measured temperature data, the water referencedensity and a water reference viscosity corresponding to the measuredtemperature data, and the phantom component reference density and aphantom component reference viscosity corresponding to the measuredtemperature data; and a second produced fluid viscosity generatorconfigured to: generate a second produced fluid viscosity based at leastin part on the obtained valve travel data, pressure data and flow ratedata; wherein the composition generator is configured to generate, withthe iterative convergence tool, the phantom component content, thebitumen content and the water content based on a difference between thefirst produced fluid viscosity and the second produced fluid viscosity.10. The system of claim 9, wherein the first produced fluid viscositygenerator comprises a neural network configured to generate the firstproduced fluid viscosity based in part on a neuron selected by aproduced fluid contaminant indicator signal.
 11. The system of claim 9,wherein the first produced fluid viscosity generator is configured togenerate the first produced fluid viscosity based on a dispersed phaseselection from a plurality of potential dispersed phases of the producedfluid.
 12. The system of claim 11, comprising a perceptron configured tomaintain a dispersed phase selection matrix based on previous selectionsby the perceptron; and generate the dispersed phase selection from thedispersed phase selection matrix based at least in part on the secondproduced fluid viscosity.
 13. The system of claim 1, wherein the phantomcomponent reference density is determined based on a Western CanadianSelect crude density model.
 14. A method for sensing an estimatedcomposition of a produced fluid being conducted from a reservoir, themethod comprising: measuring, with at least one sensing device,temperature data for the produced fluid; obtaining, with the at leastone sensing device, flow rate data, pressure data, pump speed data andvalve travel data for the produced fluid being conducted from thereservoir; generating a first produced fluid density based at least inpart on the obtained flow rate data, pressure data, and pump speed datafor the produced fluid being conducted from the reservoir; generating asecond produced fluid density based at least in part on a bitumenreference density corresponding to the measured temperature data, awater reference density corresponding to the measured temperature data,and a phantom component reference density corresponding to the measuredtemperature data; generating, with an iterative convergence tool, aphantom component content, a bitumen content and a water content for theproduced fluid based on at least in part on: a material balance of theproduced fluid and a difference between the first produced fluid densityand the second produced fluid density; and generating outputsrepresenting the phantom component content, the bitumen content and thewater content.
 15. The method of claim 14 comprising: comparing a watercut output from a water cut meter measuring the water cut of theproduced fluid being conducted from the reservoir with the phantomcomponent content, the bitumen content and the water content; andgenerating alert signals when the comparison identifies a discrepancybetween the water cut and the phantom component content, the bitumencontent and the water content.
 16. The method of claim 14, comprisinggenerating a produced fluid contaminant indicator signal based on thefirst produced fluid density, a bitumen reference density correspondingto the measured temperature data and a water reference densitycorresponding to the measured temperature data; and generating thesecond produced fluid density based in part on a neuron selection withina neural network and based on the produced fluid contaminant indicatorsignal.
 17. The method of claim 14 comprising measuring, with the atleast one sensing device, a produced fluid density; and whereingenerating the first produced fluid density comprises: generating abackup produced fluid density based at least in part on the obtainedflow rate data, pressure data, and pump speed data; and selecting themeasured produced fluid density as the first produced fluid density whenthe measured produced fluid density is within a density range betweenthe water reference density corresponding to the measured temperaturedata and the bitumen reference density corresponding to the measuredtemperature data, or selecting the backup produced fluid density as thefirst produced fluid density when the measured produced fluid density isnot within the density range.
 18. The method of claim 14, comprisingadjusting, with the iterative convergence tool, the phantom componentcontent until the material balance of the produced fluid and thedifference between the first produced fluid density and the secondproduced fluid density converge.
 19. The method of claim 14, comprising:obtaining valve travel data for the produced fluid; generating a firstproduced fluid viscosity based at least in part on: the bitumenreference density and a bitumen reference viscosity corresponding to themeasured temperature data, the water reference density and a waterreference viscosity corresponding to the measured temperature data, andthe phantom component reference density and a phantom componentreference viscosity corresponding to the measured temperature data;generating a second produced fluid viscosity based at least in part onthe obtained valve travel data, pressure data and flow rate data; andgenerating, with the iterative convergence tool, the phantom componentcontent, the bitumen content and the water content based on a differencebetween the first produced fluid viscosity and the second produced fluidviscosity.
 20. A non-transitory, computer-readable medium or mediahaving stored thereon instructions which when executed by at least oneprocessor configure the at least one processor for: measuring, with atleast one sensing device, temperature data for the produced fluid;obtaining, with the at least one sensing device, flow rate data,pressure data, pump speed data and valve travel data for the producedfluid being conducted from the reservoir; generating a first producedfluid density based at least in part on the obtained flow rate data,pressure data, and pump speed data for the produced fluid beingconducted from the reservoir; generating a second produced fluid densitybased at least in part on a bitumen reference density corresponding tothe measured temperature data, a water reference density correspondingto the measured temperature data, and a phantom component referencedensity corresponding to the measured temperature data; generating, withan iterative convergence tool, a phantom component content, a bitumencontent and a water content for the produced fluid based on at least inpart on: a material balance of the produced fluid and a differencebetween the first produced fluid density and the second produced fluiddensity; and generating outputs representing the phantom componentcontent, the bitumen content and the water content.